It is important to know the best practice in coding, that includes the proper way of naming every part of your codes.


why is it important? Almost all of the frameworks have their own naming conventions on their database and with this they made your coding experience easier.

1. Table prefix

This is important not only to make your database look good but also for security reason, example on WordPress they use wp_ by default but during installation they allow you to change it into your own prefix.

2. Table name should be plural,  Field name should be singular and words are separated by underscore

This is more readable, best for big projects. Many frameworks are using this type of convention in their database and tables this would help you adapt easier when switching to different frameworks.

3. Use auto increment ID as much as possible

code generated ID’s are very prone to error unless you are 100 percent sure that there is no way that your code will generate same ID. If you have any unique value like username it would be better to create an auto increment field as your primary key and make your username unique not primary key.

4. camelCase vs underscore_case

They are both best practice in terms of coding with either PHP, JavaScript, etc., this will make your code readable and easier to debug in case errors are encountered. But for for me camelCase is more optimize compare to underscore_case in terms of file size.

//See examples
var userName = “This is camel_case sample”;
var user_name = “This is underscored_case sample”;

5. CSS naming convention

many programmers prefer using dash an most of the plugins and CSS tutorials use this also. It is also better to use starting prefix in your CSS class or ID to make it more unique and less chance to be overwritten by any third party plugins that use CSS



It is always good to be aware of best practices in programming. This is very helpful and will absolutely help you in your coding, specially if you are about to create a plugin, lib, class or anything that is meant to use by other developers.