Fragile Base Class
The fragile base class problem is a fundamental architectural problem of object-oriented programming systems where base classes (superclasses) are considered "fragile" because seemingly safe modifications to a base class, when inherited by the derived classes, may cause the derived classes to malfunction. The programmer cannot determine whether a base class change is safe simply by examining in isolation the methods of the base class.
One possible solution is to make instance variables private to their defining class and force subclasses to use accessors to modify superclass states. A language could also make it so that subclasses can control which inherited methods are exposed publicly. These changes prevent subclasses from relying on implementation details of superclasses and allow subclasses to expose only those superclass methods that are applicable to themselves.
Another alternative solution could be to have an interface instead of superclass.
Read more about Fragile Base Class: Solutions
Famous quotes containing the words fragile, base and/or class:
“Time, to make me grieve,
Part steals, lets part abide;
And shakes this fragile frame at eve
With throbbings of noontide.”
—Thomas Hardy (18401928)
“No love is entirely without worth, even when the frivolous calls to the frivolous and the base to the base.”
—Iris Murdoch (b. 1919)
“But you must know the class of sweet womenwho are always so happy to declare they have all the rights they want; they are perfectly willing to let their husbands vote for themMare and always have been numerous, though it is an occasion for thankfulness that they are becoming less so.”
—Eliza Mother Stewart (18161908)