3 ms·
I have this analogy stuck with me: «Classes should be deep, not large». Which means: imagine a thin rectangle, but very tall, which stands on its thin side up;
by dgan 3y ago
I have this analogy stuck with me: «Classes should be deep, not large». Which means: imagine a thin rectangle, but very tall, which stands on its thin side up; now, the X-dimension is the price you have to pay upfront to understand an abstraction ("interface") and Y-dimension is what you get once you understand it. The ratio between the two is the "leverage" you get from that abstraction.
Now imagine a perfect square: you gain as much "leverage" with your abstraction as you get functionality out of it: this the prime example of your dumb setter in Java, because it takes you exactly the same effort to learn what it's doing, as for you to do it yourself.
Again this is a picturesque analogy.
- diarrhea 3y agoI don’t know if that book originated the idea, but your description fits closely to Philosophy of Software Design.
- henkelibonk 3y agoSimilarly, the leverage or “reusability” equals complexity of the implementation divided by size of the interface