Answer the question
In order to leave comments, you need to log in
Clean code: class names?
From "Clean Code":
Class and object names must be nouns and their combinations: Customer, WikiPage, Account, and AddressParser. Avoid using words such as Manager, Processor, Data, or Info in class names.
Answer the question
In order to leave comments, you need to log in
I think that it is the Parser that also does not suit them, just like the Manager or Processor. As a valid name, they cite AddressParser as an example, i.e. parser applicable specifically to the address. Likewise, options such as AccountManager or TemplateProcessor would be valid.
By the word Parser, I already understand what the class does - it takes something big (most likely, text) and parses it into small components. I roughly understand the purpose of the class and its interface.
But Manager / Processor / Data / Info ... Too general words. Exaggerating - here is the DataProcessor class - what does it do? Processes data, prompts KO! But what data? How does it process?
Another example: AddressProcessor . What does this class do? It can convert all addresses to the same format, it can create a graph for a logistics program, or it can process DNS records.
You can always find a more accurate replacement for the words Manage / Process / Data / Info
The simplest thing is to email them and ask them directly. I think they will be better able to explain their point of view than we are composing here now.
According to the same book, the class name should define its scope of responsibility. Manager and Processor define too broad a field of responsibility. Parser - a specific description of responsibility (parsing something).
Apparently in its structure Manager, Processor, Data and Info are system classes and do not represent a data object. Apparently he wanted to say that you need to clearly separate data and data processing classes.
Manager, Processor, Data or Info are really too general words. Manager, you can call almost any class that stores any data or access to resources. Similarly, with all the other words from this list. And Info is generally a masterpiece that I have repeatedly met in code.
For example, instead of calling the class NetworkConectionManager, you can call it NetworkConections and this, in my opinion, will be clearer.
The answer was found hundreds of pages later:
The class name should describe its responsibilities. [...] If you can't find a clear, short name for a class, it's probably too big. The more obscure the class name, the more likely it is to have too many responsibilities. In particular, the presence of the rogue words "Processor", "Manager", and "Super" in class names is often indicative of an undesirable pooling of responsibilities.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question