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:

    Parents need all the help they can get. The strongest as well as the most fragile family requires a vital network of social supports.
    Bernice Weissbourd (20th century)

    They must to keep their certainty accuse
    All that are different of a base intent;
    Pull down established honour; hawk for news
    Whatever their loose phantasy invent
    And murmur it with bated breath....
    William Butler Yeats (1865–1939)

    There is a struggle between the Oriental and the Occidental in every nation; some who would be forever contemplating the sun, and some who are hastening toward the sunset. The former class says to the latter, When you have reached the sunset, you will be no nearer to the sun. To which the latter replies, But we so prolong the day.
    Henry David Thoreau (1817–1862)