I came across a few articles like this one, which suggest that some words should never be used as part of a class name. When a class has one of those words in the name, it means the code should be refactored or redesigned.
Example:
Manager
Reason: Since almost all classes "manage" something and the meaning of "Manager" is very broad, people can put a lot of responsibilities to a "Manager" class while still being able to claim the class does "only one thing". As a result, naming a class with "Manager" does not say much about what the class actually does. The article mentioned earlier, "Naming Java Classes Without a 'Manager' ", showed this point:
For instance, take a class named "UrlManager" - you cannot tell whether it pool URLs, manipulates URLs or audits the use of them. All the name tells you is that this is not a URL, but it does somehow work with them. On the other hand, the name "UrlBuilder" gives a much better picture of what the class does.
Another example:
Helper
Reason: A class name like "ThreadHelper" makes people wonder why it's needed and why it cannot just be part of the "Thread" class. Is it actually an adapter or a decorator? If so, name it that way. Is class "Thread" taking too much responsibility already? If so, refactor and give the new class a meaningful name. "Helper" says nothing about what it's doing or how it's helping.
What are other words in a class name that would signal a need for refactoring or redesign and should be avoided? Why?
Edit: I would think those words are used a lot since
- they generally have broad meanings
- they can fit in almost all contexts
- they stop designers thinking about better designs or names
- people believe it's OK to use them
The book Clean Code listed more but no reasons were given:
Avoid words like Manager, Processor, Data, or Info in the name of a class.
It would be great if someone could provide possible reasons for them.
Related questions: