I don’t like the “Base” suffix

Today, I was reviewing a set of recommendation for naming types intended to be inherited from. The author suggested using the “Base” suffix for such types. I personally don’t like to do this. Here are the reasons:

First, what do you call base of a base class? Or what do you call an abstract subclass of a base class? The problem with the base suffix is that in many cases, “bases” end up being in the middle of the inheritance hierarchy.

Secondly, base types are often used as return types. When that happens, the “Base” suffix is meaningless. The suffix is only meaningful for those who inherit from the type (not many people) and not so much for those who use the type (many people). For example, property typed as the “base” type seems strange to me:

public CollectionBase<string> Names {
    get { … }

I find the following much better.

public Collection<string> Names {
    get { … }

Comments (6)

  1. Gavin Greig says:

    On the whole, I’m inclined to agree with you, but it might depend on who is the intended audience for the classes. If you’re developing a library for use by others, than "Base" might be a good suffix to use because it <em>is</em> the base class from your user’s point of view, even if <em>you</em> happen to know that it’s a derived class.

    If you’re looking for an alternative, you could consider something a bit more non-committal as a suffix, like "Type". To me, the presence of such a non-committal word would tend to indicate that it’s a non-committed class – in other words, one that I would expect to derive my own classes from, rather than use it directly. I think I made a similar case for the use of "Type" in generics, rather than T, but since "Type" was not used then, it would still be available for this usage.

    My order of preference:

    1. No suffix

    2. "Type" suffix

    3. "Base" suffix

  2. Diego Canepa says:

    I agree. I never like the base suffix. For me, it’s sounds like an hungarian notation for types. Anyway, I red the book twice, It’s really cool and totally useful.


  3. AndrewSeven says:

    I’ve somteimes think of the base suffix in part as a way to avoid taking the "good" name, or I’ve refactored to reuse most of the base.

    Perhaps an internal CollectionBase which Collection and SpecializedColletion inherit.

    When I see a base suffix its almost like it is trying to convince me : do not cast to this.

  4. MSDN Archive says:

    I haven’t found a naming convention here that I like. In some projects I use the "Abstract" prefix, as in "AbstractCollection". I find the name more correct, informative & relevant than "CollectionBase". On the downside, it’s unwieldy (making short names quite long) and interferes with intellisense (suddenly all abstract types appear together, and I have to wade through 8 characters before I can begin to disambiguate.

  5. Leaf says:

    Basically the abstract, base and many other suffixes/prefixes simply tend to clutter the code.

    Simply name your interface/abstract class with more "abstract" name.

  6. Chris Eargle says:

    Leaf is correct. Think of it this way: Dog and Cat inherit from Mammal. If you use the name MammalBase, you have cluttered the code for no good reason. If I only cared about the mammal type (say it implements Speak()), I would call Mammal mammal = new Dog()… and then change it to a factory method or other creational pattern depending on the code.

Skip to main content