55

Which nouns do you find yourself putting regularly at the end of your classes?

For example, I have a habit of sticking Info onto classes that pass information around but don't do a great deal:

  • ImportInfo
  • SiteInfo

Or for Coordinating classes:

  • UserManager
  • SecurityManager

I end up using Builder quite often for string related classes, even if it barely does any building:

  • TemplateBuilder
  • HtmlBuilder

And of course the timeless Helper/Utility class:

  • PhraseHelper
  • NumberUtility
  • FileHelper

Have you got any good, by which I mean concise and descriptive, nouns or words you regularly use to denote the class' main role?

This question is aimed at the .NET world, but can extend to Java, C++, Python and so on.

Chris S
  • 64,770
  • 52
  • 221
  • 239
  • Related posts - [What is a better name than Manager, Processor etc?](https://stackoverflow.com/q/5569666/465053) *,* [Naming convention and structure for utility classes and methods](https://stackoverflow.com/q/1271254/465053), [What's the best approach to naming classes?](https://stackoverflow.com/q/38019/465053) , & [Naming Classes - How to avoid calling everything a “Manager”?](https://stackoverflow.com/q/1866794/465053) – RBT Jul 11 '18 at 09:32

14 Answers14

46

You can take a look at source-code-wordle.de, I have analyzed there the most frequently used suffixes of class names of the .NET framework and some other libraries.

The top 20 are:

  • attribute
  • type
  • helper
  • collection
  • converter
  • handler
  • info
  • provider
  • exception
  • service
  • element
  • manager
  • node
  • option
  • factory
  • context
  • item
  • designer
  • base
  • editor
Markus Meyer
  • 173
  • 1
  • 6
  • 14
9

I append pattern name at the end if i follow one (i.e. FooRepository).
Trying to avoid -Helper, -Manager, -Utils.

Arnis Lapsa
  • 45,880
  • 29
  • 115
  • 195
  • 14
    +1: those 'Helper' and 'Manager' names usually imply that you're wrapping up a procedural system and pretending it's object-oriented. There's nothing wrong with the procedural approach but if you want the benefits of object orientation then the objects should perform their own behaviour for the most part. – Kylotan Jul 28 '09 at 14:40
  • 2
    +1 for saying you shuold avoid Helper, Manager, etc. – rmeador Jul 28 '09 at 15:13
  • 11
    What's procedural about the word Manager? Helper I can understand, and Util and Tools, but Manager seems like it lends itself to being an object. – Chris S Jul 28 '09 at 20:13
7

I use Provider and Helper a lot.

NotMe
  • 87,343
  • 27
  • 171
  • 245
5

Util

  • EnumUtil
  • ParseUtil
  • StringUtil
  • etc ...
JaredPar
  • 733,204
  • 149
  • 1,241
  • 1,454
4

Base, Reader, Writer, Manager, File.. some others.

David Anderson
  • 13,558
  • 5
  • 50
  • 76
2

If my class is specifically doing calculations, I will prepend Calc

Examples:

  • TaxCalc
  • TipCalc
  • DateCalc
Matthew Jones
  • 25,644
  • 17
  • 102
  • 155
2

Tests for unit test classes

Charlie
  • 10,227
  • 10
  • 51
  • 92
2

I find myself sometimes appending the name of the parent class the one I'm writing I want to inherit. Sometimes it sounds weird especially with an Animal example (DogAnimal, FishAnimal, ...) but it makes finding subtypes easier in a list of classes.

Chet
  • 21,375
  • 10
  • 40
  • 58
  • 7
    LabradorDogCanineCarnivoreMammalVertebrateAnimalEukaryote, that sort of thing? ;-) – Steve Jessop Jul 28 '09 at 14:47
  • Although I joke, I actually don't think this is a bad idea, since in practice it's quite common to have 2-level hierarchies. WindowsThingy, LinuxThingy, MacOSThingy; LoopbackWotsit, NetworkWotsit, SerialWotsit; MysqlAdaptor, SqlserverAdaptor, SqliteAdaptor. – Steve Jessop Jul 28 '09 at 16:29
  • haha, yeah, I usually stop at two. Most inheritance beyond that is from the API. – Chet Jul 28 '09 at 16:50
  • `IPredicate` < `PredicateBase` < `PropertyPredicateBase` < `LessThanPropertyPredicate` – Dan Lugg Jan 04 '17 at 02:02
1
Factory

Also:

Provider
AlbertoPL
  • 11,479
  • 5
  • 49
  • 73
1
  • Factory
  • Helper
  • Utils
  • Job
  • Entity
Charlie
  • 2,096
  • 2
  • 22
  • 34
1

On occasion I use

Target

As in

  • UploadTarget
  • ProcessingTarget

I don't think I had before Silverlight / WPF but I now also use

Converter

As in:

  • CurrentTimeDisplayConverter
  • TimeDeltaConverter
t3rse
  • 10,024
  • 11
  • 57
  • 84
1

I am often using :

  • Protocol (Specific protocol implementation)
  • Manager (Class managing the process)
  • Emulator (Emulate something...)
Matthieu
  • 114
  • 3
0

why of course...

Base

works both sides.

;-)

icelava
  • 9,787
  • 7
  • 52
  • 74
0

Controller and View.

Robert S.
  • 25,266
  • 14
  • 84
  • 116