What names do you find yourself prepending/appending to classes regularly?
.NetNaming Conventions.Net Problem Overview
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.
.Net Solutions
Solution 1 - .Net
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
Solution 2 - .Net
I append pattern name at the end if i follow one (i.e. FooRepository).
Trying to avoid -Helper, -Manager, -Utils.
Solution 3 - .Net
I use Provider and Helper a lot.
Solution 4 - .Net
Util
- EnumUtil
- ParseUtil
- StringUtil
- etc ...
Solution 5 - .Net
Base, Reader, Writer, Manager, File.. some others.
Solution 6 - .Net
If my class is specifically doing calculations, I will prepend Calc
Examples:
- TaxCalc
- TipCalc
- DateCalc
Solution 7 - .Net
Tests
for unit test classes
Solution 8 - .Net
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.
Solution 9 - .Net
Factory
Also:
Provider
Solution 10 - .Net
- Factory
- Helper
- Utils
- Job
- Entity
Solution 11 - .Net
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
Solution 12 - .Net
I am often using :
- Protocol (Specific protocol implementation)
- Manager (Class managing the process)
- Emulator (Emulate something...)
Solution 13 - .Net
why of course...
Base
works both sides.
;-)
Solution 14 - .Net
Controller
and View
.