Fragile Base Class

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:

    lady through whose profound and fragile lips
    the sweet small clumsy feet of April came

    into the ragged meadow of my soul.
    —E.E. (Edward Estlin)

    I am sure my bones would not rest in an English grave, or my clay mix with the earth of that country. I believe the thought would drive me mad on my death-bed could I suppose that any of my friends would be base enough to convey my carcass back to her soil. I would not even feed her worms if I could help it.
    George Gordon Noel Byron (1788–1824)

    Where justice is denied, where poverty is enforced, where ignorance prevails, and where any one class is made to feel that society is in an organized conspiracy to oppress, rob, and degrade them, neither persons nor property will be safe.
    Frederick Douglass (c.1817–1895)