To me "Short and simple or long and complex" is like asking how long should a program be, depends, the main purpose of a name is clearly indicate what it is/does, second is how long; the name should be as short as possible without losing it's main goal. Restrict oneself with artificial rules seems useless to me, the amount of chars or words are not the purpose of a name.
I usually make a stupid long name and then ask myself, and start iterating, can I shorten it while keeping understandable? when the answer is no, that's what I keep. If the end result is inconvenient (too long and used too often) maybe there is a deeper problem in my code.
Previously at Uber, Skyscanner, Skype/Microsoft. I love to help people grow and share what I learned. I write longer articles on software engineering at blog.pragmaticengineer.com.
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.
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
What is "Thoughtful naming"? Short and simple or long and complex? My base of naming is one word, sometime two words. No longer.
To me "Short and simple or long and complex" is like asking how long should a program be, depends, the main purpose of a name is clearly indicate what it is/does, second is how long; the name should be as short as possible without losing it's main goal. Restrict oneself with artificial rules seems useless to me, the amount of chars or words are not the purpose of a name.
I usually make a stupid long name and then ask myself, and start iterating, can I shorten it while keeping understandable? when the answer is no, that's what I keep. If the end result is inconvenient (too long and used too often) maybe there is a deeper problem in my code.
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.
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.