6 ms·
With naming what IMO matters more than choosing one name, is choosing a name that is consistent with other similar names in the codebase. A new developer will l
by ttiurani 5y ago
With naming what IMO matters more than choosing one name, is choosing a name that is consistent with other similar names in the codebase. A new developer will learn your project's specific convention in a few minutes, but will be completely lost if the convention is routinely violated here and there. This is especially important with what verbs to use in methods, and how to name interfaces/classes in a way that respects both the business domain and the techical use.
I've seen way too many times how much confusion is created and time wasted when a developer not too familiar with the project comes up with a brand new verb for a common action, and couples it with a new synonym for an existing business domain entity – or worse still, uses the same name previously meant for a completely different domain entity.
The unfortunate burden with this is that a new developer might be right that their name is better for their use case, which then leads to laboursome debates about which is more important: consistency or slightly crisper name for the one use case.
- vas1 5y agoCouldn’t agree more with this. Consistency is key even if the convention used is awkward
- jawns 5y agoThis goes double for APIs, and triple for externally facing APIs, where typically the people who are working with it aren't familiar with your code base or naming conventions. That's why good API design is so hard. Every name you assign to something becomes a convention by default.
- hinkley 5y agoYou have to be careful with your definitions. Don’t use different definitions of the same verb/noun in different places. You get one. If you need another definition elsewhere, use a synonym. It is not beneath you to hit thesaurus.com while picking a name.
- jeremydeanlakey 5y agoA thesaurus is one of my favorite dev tools.
- joekrill 5y ago100%. I use RhymeZone and Wordnik more than I care to admit during development work.
- jariel 5y agoYes, convention is more important that the quality of the convention. The convention abnegates the need to think about things, and for a developer, thoughts are precious.
- PicassoCTs 5y agoWith a good convention, even more important, structure can be derived and deduced, without reading the documentation. I love it, when i begin to grasp the structure of a codebase, write a line and hit auto-complete and the codebase was reliable. Functionname exists and parameters expected are served up. The code just feels so much more discover-able in such moments.
- archsurface 5y agoNaming gets far worse than that. I've worked on code where the naming was not just unhelpful, it was outright misleading. One of the worst I remember was a project which unsurprisingly was named after a game of thrones character. As I never watched game of thrones it took me about two weeks before I could even remember the stupid name, during which time I was also dumbfounded as to how the program worked until I realised the naming in the code was equally bad, completely misleading. Then there's the place where the stg1 environment was actually the dev0 environment...
- wsc981 5y ago> I've worked on code where the naming was not just unhelpful, it was outright misleading. It's one way to achieve job security for life though: https://github.com/Droogans/unmaintainable-code https://github.com/Droogans/unmaintainable-code
- dnautics 5y agoOne of the best coding interviews I had was an paired debugging session and the problem boiled down to a poorly named parameter at the beginning.
- scubbo 5y ago> Then there's the place where the stg1 environment was actually the dev0 environment... Hey, think yourself lucky. It's only a pretty recent occurrence that my team has more than just the two "Prod" and "Non-Prod" environments...
- aYsY4dDQ2NrcNzA 5y agoUsing the name “prod” for anything other than delivering code to external customers is one of my eternal pet peeves.
- saurik 5y agoWhen I was working on a small game startup back 20 years ago, I renamed our all the high-level projects of our codebase into specifically-ancient Greek and then left a "glossary.txt" in the root directory so people could brush up on their language skills... this did not last for very long ;P.