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:
“The course of my long life hath reached at last
In fragile bark oer a tempestuous sea
The common harbor, where must rendered be
Account for all the actions of the past.”
—Henry Wadsworth Longfellow (18071882)
“For those who are base in judgement do not know the good they hold in their hands until they cast it off.”
—Sophocles (497406/5 B.C.)
“We of the sinking middle class ... may sink without further struggles into the working class where we belong, and probably when we get there it will not be so dreadful as we feared, for, after all, we have nothing to lose but our aitches.”
—George Orwell (19031950)