PolarCoffee

The importance of good naming

Before start just get a quick review about naming and the most used cases (in programming)
  • lowerCamelCase
  • CapitalCamelCase
  • snake_case
  • SCREAMING_SNAKE_CASE
  • flatcase
  • UPPERFLATCASE
Clarification: This list does not take in count the other variants such as kebab (screaming), train, http, etc, that are used for html, css or http because this article is oriented to programming and some cases for database naming.
This tips are just based on my personal experience and preferences. This article is oriented as a guide and does not pretend in any way being a standard of programming or any other thing
It does not really matter what is your preference when it comes to naming, however the only rule that may apply is constancy as long as you stay constant to a standard it is all about your taste

The most common cases

For the lowerCamelCase and the snake_case is great for variable/method naming For example
var myInputNumber = 35;
var some_other_input = 40;

/* OR */

public int getMyInputNumber(){
    return myInputNumber;
}

public int get_some_other_input(){
    return some_other_input;
}
What about CapitalCamelCase, well that looks cool for classes
public class MyTestingClass{
/* do some stuff */
}
So… where the SCREAMING_SNAKE_CASE went?, well I think it looks pretty cool for constants
public class MyTestingClass{
    public static final int HOURS_OF_DAY = 24;
}
Show me something with flatcase and UPPERFLATCASE. True to be told, personally i never used the UPPERFLATCASE, so if you have some experience with it let me know the flatcase on the other hand, it comes handy for package naming (mostly in Java) but this depends on your company conventions too, so is not written in stone
package me.polarcoffe.testpackage;
public class MyTestingClass{
    public static final int HOURS_OF_DAY = 24;
}

What’s the deal with databases?

Well basically the same thing, you could very well think like this: the table in the end is the class, the columns goes as fields/properties and the stored procedures or even triggers are just methods

so… plurals or singulars

Well that is what started the civil warr… anyway I will dare to say, singulars “Why?? that’s not accurate, those are sets of data…” yes but there are two things to take in count. In practice, you often use one entity at the time It is easier grammatically speaking to say octopus than octopuses, not all words have different letter for their plurals but there are some puntual cases https://www.quora.com/For-which-English-nouns-are-the-singular-and-plural-forms-the-same-word

In conclusion

It all reduces to your preferences and what you find to be a good aesthetic for your code Well I hope this would be helpful in some way  

Leave a Comment

Your email address will not be published. Required fields are marked *