I just read a great example of a leaky abstraction at Ayendes blog

public interface IQueue
{
    void Enqueue(T o);
    T Dequeue();
    bool IsEmpty { get; }
}

Ayende is using this abstraction to handle queuing. What if the queue gets so big it starts eating into your memory ? You would need to save the queue to the disk right ? Well, then suddenly T needs to serializable. But it does not end there. All objects that are referenced by T also need to be serializable. Suddenly you’ve got a big problem on your hand due to a leaky abstraction.

I love the subtleties of software design :)

F Share