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:

    At twenty you have many desires which hide the truth, but beyond forty there are only real and fragile truths—your abilities and your failings.
    Gérard Depardieu (b. 1948)

    When a man speaks the truth in the spirit of truth, his eye is as clear as the heavens. When he has base ends, and speaks falsely, the eye is muddy and sometimes asquint.
    Ralph Waldo Emerson (1803–1882)

    The ideas of the ruling class are in every epoch the ruling ideas, i.e. the class which is the ruling material force of society, is at the same time its ruling intellectual force.
    Karl Marx (1818–1883)