jargon

Comparison

Deep modulevsInterface segregation principle

Deep module

the interface is three methods and the implementation is two thousand lines, and that ratio is the point.

Ousterhout's framing that a good module has a small interface relative to the functionality behind it, and a bad one — a shallow module — has an interface nearly as complicated as what it hides. It is the sharpest available argument against reflexively splitting classes: many small classes each with a wide interface is more total complexity, not less. It also explains why a pass-through method or a one-line wrapper class feels wrong even when it satisfies every principle on a checklist.

Full entry →

Interface segregation principle

you implemented an eleven-method interface to get at one of them and threw not-implemented from the other ten.

The principle that a client should not be forced to depend on methods it does not use, which in practice means preferring several small role interfaces to one large one. The observable cost of getting it wrong is not aesthetic: every implementer is recompiled and every test double is rewritten when an unrelated method is added to the fat interface. Role interfaces also make it obvious what a collaborator is actually for, because the name describes the role rather than the class.

Full entry →

Related comparisons