views:

38

answers:

3

I sometimes see types named with a suffix of "base", presumably meaning it forms the parent of one or more sub-types. Is implying the use of inheritance in the type name like this a code smell?

+1  A: 

Sometimes the common features of two child classes does not have a natural language equivalent, or the most obvious name would result in a name collision. In such cases I sometimes use a suffix in this manner. I would not consider it a code smell unless it was part of the exported API intended for use by other developers using a library.

Jherico
+1  A: 

It is also a common practice to give an implementation for each interface you provide in your API, which many people create with the type name suffix "base". Often it is not possible to instantiate these classes to let the user of the API know that this should be inherited from.

NickLarsen
+1  A: 

Very often the "Base" suffix is used for abstract classes.

Romain Verdier