The Problem of the Fragile Base Class

If (almost) all classes inherit from a single base class in a system, we get the problem of the fragile base class: a change to that single base class can break subclasses in non-obvious ways.

But this problem must be weighed against the advantages of a single base class. The foremost advantage is probably that one can add a capability to the base class and have it available to every class in the system if they all inherit from that base class.

What's more, the very problem can be an advantage: if some capability is provided in the base class, and there is a problem with it, the fix will also be all in one place!

The upshot: if you use a single base class, be very careful about changing it!

Comments

Popular posts from this blog

In ancapistan, if you have no property, you have no rights

"Pre-Galilean" Foolishness

Against their will / we were taxing against their will / we were young and we were strong and we were taxing against their will