But use generic names for abstract base classes

The most abstract base class in a hierarchy should have the most generic, abstract name, with names of subclasses denoting refinement. Don't give an abstract base class a name that is derived from a concrete derived class. Also, avoid names like TBaseFoo or TAbstractFoo, where TFoo is a subclass, because nothing in the name distinguishes TFoo from other subclasses of TBaseFoo. TStandardFoo is only marginally better, but acceptable.

NOTE There is an exception: if your abstract base class can have one and only one concrete derived class, it is acceptable to give that derived class the generic name. In that case, the abstract class should have Abstract in its name. For example, the model class hierarchy has TAbstractModel, from which descended TModel and TModelSurrogate. TModel is the base for all concrete derived classes (as a surrogate, TModelSurrogate doesn't count).

If you find you have trouble with these rules, perhaps your class hierarchy needs rethinking. For example, an earlier text class hierarchy included TText and TBaseText; TBaseText was an abstract base class from which TText descends. Normally, TText, as the more generic name, should be used for the base class. The new hierarchy works this way, with TStandardText as the default implementation.

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker