Best Naming Convention For Programmers

Best naming convention for programmers

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

  1. Lower case: name=”firstname”
  2. Capitalized: name = “FirstName”
  3. CamelCase: name = “firstName”
  4. 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?

I program on different languages (html, css, javascript, php, sql, swift, java,etc.). And yes, after years of coding, I made a good mix of every convention per project (shame on me).

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?

Search