DEV Community

Sergiu Mureşan
Sergiu Mureşan

Posted on

Some tips on naming in software development

Covering some issues (and solutions) I found when working in the industry related to naming conventions. They might not be much but if you apply them you are safe from creating a naming mess out of you project.

Tell me what you think. Constructive criticism is always welcome!

Top comments (4)

Collapse
 
jhotterbeekx profile image
John Hotterbeekx

I love the attention people are giving to clean code. Clean readable code is, in my opinion, even more important than the code actually working. And kudos for you for giving attention to this subject!

After watching you video I'm not sure I understand your point in not using the same conventions across multiple languages. Working on projects with C#, Javascript, HTML, CSS, Powershell scripts and what not. I think it will be an impossible task to adjust your coding styles between all the languages so they don't overlap. Though my Javascript conventions aren't exactly the same as I have them in C#, I don't see any issues in them being the same. Could you explain some more on why you think this is important?

Otherwise great subjects to at least think about. One think I think didn't really belong is the naming conventions. I really agree that being consistent in your naming conventions is key to writing clean code, and if your language forces you a certain convention you have to adjust to that. Other then that, which convention you use, is a personal opinion. Of course there are best practices, like writing constants in all capitals, but on other parts you'll find small nuances on them. Some prefer camel, some pascal, some snake, the most important is that they should make your code more readable and try to be consistent. All the other parts are really a must, use good names for your methods and variables and keep out the spelling mistakes.

If I could give your one tip for your next video, try and do the code in an IDE. I think adding syntax highlighting could make your video's a little easier to understand.

Collapse
 
codevault profile image
Sergiu Mureşan

I tend to think of my code as an extension to the existing core libraries and using the same naming convention is more aesthetically pleasing and consistent than using something else. Only in some specific cases it is functionally wrong:

  • Other language's conventions applied to HTML which is not case sensitive
  • When using automated serialization/deserialization (ex: gson or Hibernate in Java not finding getters and setters unless they contain the field's name starting with a capital letter)
  • When using reflection (although that is usually a problem when you have to use it on a project that doesn't use the same convention as the standard libraries)

I found out from experience that some libraries do make assumptions about what naming conventions you are using. In some very niche cases, where you don't have access to a good IDE and don't have autocomplete, it might even hinder productivity.

I started with Notepad++ as it is very language agnostic and I want the videos to stay that way. Thanks for the tip, if I find an IDE that fits the bill I will 100% use it.

You are the first person giving a thorough review on one of my videos and I really appreciate that and will keep in mind your feedback when going further, thank you!

Collapse
 
jhotterbeekx profile image
John Hotterbeekx

I tend to think of my code as an extension to the existing core libraries
I find this a really interesting concept, I haven't though about it like that. It is true that the basic language code gives you a lot of guidance in code style that you can just as easy take over. Thanks for that insight!

I also get where you come from with Notepad++. I still you it a lot as well, but not for coding. These days I love that I accepted IDE's and tools like Visual Studio (Code) and Resharper. They are making my life so much easier and my coding so much more productive.

Thread Thread
 
codevault profile image
Sergiu Mureşan • Edited

Definitely. My boss doesn't really like the idea of using a different IDE than Visual Studio 2013 for our project and, while I don't use it for web dev, some of my colleagues do and it definitely hinders their productivity :/

Sorry about the late response, busy week.