V
V
Volodfarun2019-09-24 19:43:38
Books
Volodfarun, 2019-09-24 19:43:38

Books to help you learn how to properly name classes?

I sat for an hour and couldn't think of a good name.
The thing is that, on the one hand, it is just a handler
, on the other hand, it is dependent (DI) on the class that supplies data, data of a certain type, which are first processed by one then the second and third classes, and only after all these mutations go to the class we need, and how to write the order of classes in the name is not correct, but how will another developer understand that before processing the data they need to be passed through 3 levels of processing ??? (don't ask why you just need it).
For example, writing MathCalculate is too generalized, although this is exactly what it does, but it is not clear what exactly the calculator is, if you write ala MathCalculateDataTypeClassName, then not a word about mutations, again, it is not obvious, and if MathCalculateDataTypeClassNameClassNameMutation1ClassNameMutation2ClassNameMutation3 even more so. Like it or not, it is impossible to create a directly understandable code so that it is clear what and why to perform. What is my problem?) what books put the head in place in this regard?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Romashkan, 2019-09-24
@EvgeniiR

What is my problem?)

That your class does too much and knows too much.
He should not know about any "3 levels of processing" of data that come to him.
It accepts data of a specific format and returns data of a specific format. What happened to them for and what will happen after he does not care.
If it is not possible to express at the type level all the requirements for incoming data, the class returns an error if the data did not arrive in the form it expected.
Read - McConnell, "Perfect Code". The book is thick, but not technically complicated, any nuances of naming are described there.
Well, in the future, proceed from the questions "why am I doing this?" and "what other options are there to do this?"

B
Boris Shepelev, 2019-09-24
@bshepelev

capaciously. And they must be universal. I took a block from one part of the page and placed it in another. The performance (appearance) will be preserved.
And according to your theory, this is no longer possible, since everything is connected.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question