So what’s the trend on naming conventions for variables, functions, methods, databases, etc?
There are many types of conventions for different type of uses
- Lower case: name=”firstname”
- Capitalized: name = “FirstName”
- CamelCase: name = “firstName”
- UnderScores: name = “first_name”
Why naming convention is important?
One quickly learns that is good to standardise developing procedures. If you started as a freelance and scale up into an agency,studio,company,etc , the most probable thing is that each team member uses it’s own naming convention or doesn’t even have one at all.
This can easily become a future headache, maybe you are calling a function and forget to capitalize correctly, this simple character can end on some minutes to hours of debugging.
What convention should you use?
I was looking for that answer too, but found an awesome response in this post, that says:
The most important aspect is consistency. Pick one way and use it everywhere.
Gotta say, that I couldn’t agree more. There might be a science behind naming conventions, but do what ever works for you or your team, but stick to it, always, forever and ever (no exceptions).
What convention do I use?
So now, talking to the guys on our team at Mobkii we will be using the following convention.
For variables, database names, ids, or html tags will be using all our variables in english in lower case, and we’ll be using Camelcase for functions or methods.
So what’s your naming convention and why?