DEV Community

Discussion on: Readable Code

Collapse
 
gergelyorosz profile image
Gergely Orosz

Good question. In my opinion, the easier to understand the purpose, the better. For the most part, this would mean simple & short.

But it depends on the codebase and domain. E.g. in a large codebase following agreed on architecture principles on using e.g. viewcontrollers and the concept of interactors, the name RootViewControllerInteractor could count as a good name. Or in an accounting domain, EndOfYearCalculationController could also be a thoughtful name.

My point is to put thought to come up with clear names that make sense to you and other devs who will work on the same codebase.

Collapse
 
vlasales profile image
Vlastimil Pospichal • Edited

I use namespaces for split words, Interactor\Controller\View\Root, Calculator\Controller\EndOfYear etc. Nouns for things, verbs for methods, adjectives for interfaces.

Two words in a method name shows violation SRP.