B
B
BonBon Slick2018-02-03 17:29:20
PHP
BonBon Slick, 2018-02-03 17:29:20

What is the norm for class names?

I haven't seen the https://www.php-fig.org/psr/ standards for the length of the class name.
For example, if a developer writes such a name to improve the readability of the code, is this SomeClassNameThatDoSomeCoolStuffcorrect?
As planned, when you see such a class, it is immediately clear what it does, although if there is some kind of constant in it, then such a class can occupy the entire line, that is, approximately 125 characters, including indents.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-02-03
@BonBonSlick

There is always a reasonable limit and a synonym, so SomeClassNameThatDoSomeCoolStuff may well be CoolStuff
Moreover, class methods are also named, so it is reasonable to combine such "cool crap" into helpers. So here StuffHelper::doSomeCool() seems to be more correct, and it's not half a line anymore and it's understandable.
Just avoid extremes, for example:
we are looking for a middle ground, but it is absent without context, so it is problematic to introduce this into the standard. And why, if there is sound logic.
Attention: to hell with the Russian language from the code, $tovarit really infuriates

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question