jargon

Comparison

Fragile base classvsInheritance

Fragile base class

a harmless-looking change inside the parent broke three subclasses in another repository that you had never seen.

The failure mode where a superclass cannot be changed safely because subclasses depend on its internal call structure, not merely its public contract. It is why inheritance across a library boundary is a much larger promise than it looks: the moment someone extends your class, its private call sequence is part of your API. This is the concrete cost that `composition-over-inheritance` is arguing against.

Full entry →

Inheritance

you got twenty methods you never asked for along with the one you wanted, and you cannot give any of them back.

Deriving a class from another so it acquires the parent's fields and methods and may replace some of them. It is the strongest coupling one class can have to another: the subclass depends not just on the parent's public surface but on which of its own methods the parent calls internally. That is why it is the default in textbooks and increasingly the second choice in practice.

Full entry →

Related comparisons