2 ms·
I have to care about what's inside it (to know whether the performance is up to what I need) rather than just the interface. To me, that's leaking. For exampl
by AnimalMuppet 6y ago
I have to care about what's inside it (to know whether the performance is up to what I need) rather than just the interface. To me, that's leaking.
For example, if I have to care whether the "collection" is implemented as a linked list or as a vector, the the "collection" abstraction has leaked.
- lmm 6y agoAbstractions are equivalences, not equalities. You shouldn't expect an abstraction to make a linked list the same thing as a vector - they aren't, and they never will be - but they are equivalent for certain purposes, and a good abstraction can capture that equivalence. The performance of those two different collections is not the same, but that's not a leak unless the abstraction tried to claim that it somehow would be the same.
- wtetzner 6y ago> You shouldn't expect an abstraction to make a linked list the same thing as a vector - they aren't, and they never will be I would even argue that's the point of an abstraction. Hide the details that don't matter to the caller. If performance is a detail that matters, and the abstraction doesn't capture it, then you're using the wrong abstraction.