All about coding standards & Best Practices

All about coding standards & Best Practices

Here, I have written about traditional coding standards and my own idea about the coding standards (please read section 3). And why are they needed, how they should be followed and much more.


Section 1 - Why are the coding standards needed ?

A wheel & A code.

Centuries ago when the wheel, one of the most primitive inventions of human history was invented it changed the way the human race evolved, moved, migrated themselves and the goods they needed.

Have we as intellectual animals ever tried to make innovative, efficient changes in the very basic need of modern human society ? 

Yes, but the shape or the geometric structure of the wheels never changed since the beginning. Why ? Because no matter what, we are bound to follow basic principles of the idea of wheels as it is the property which makes wheels what they are.

This concept is also important in programming. With rigorously changing technologies there are new concepts, tools, and platforms being introduced every single day. And in this never ending race of mastering so called “the cutting edge technology” sometimes we as Programmer/ Developer/ Coder or “The Creators of the digital universe” forget that there are few most basic principles which should be followed in order to keep the agenda of evolution of programming as efficient as the same of a wheel.

Standards are important because …

  • They increase readability, Maintainability
  • Improves knowledge transfer among the team
  • Adds consistency, scalability and security to the code


Section 2 - What are the most basic coding standards which should be followed ?

I am aware that most of us know these principles, but somehow we never(or most of the time) make conscious efforts to stick up to them.

Below are the well known principles:

KISS - Keep It Simple Stupid

YAGNI - You Ain't Gonna Need It DRY - Don’t Repeat Yourself

Naming Conventions



Section 3 - My own idea about the coding standards

Let’s talk about the things which are not taken seriously or given least attention with respect to coding standards.


Choosing the right standards for each software environment -

As per a famous saying “we can never judge a fish by its ability to climb the tree”.

Many times we tend to follow the wrong standards because they have been proven to work for some other project, language or team. But it makes no sense because all the programming languages have their own features and restrictions. So Always choose standards you want your team to follow while coding according to the need of the hour.


Create Team Language - 

All the teams should have their own specific language or the “Jargons” as we call it. It can be the naming conventions, structure of the directories and files, etc.,

I have noticed that many teams do not have their language and it creates issues when there is a miscommunication or a change in the team.

If there is a common language defined, it autonomously fades away the chances of disaster even without the need of specifying all minute details at all the stages of a software lifecycle.

Add Backups to your daily habits - Most of the developers I have come across have never developed this habit and the excuse is “nothing has gone wrong till now, so why do we need it”. And the answer to that is “There is nothing called time-machine in the world yet”.

Team leaders should force the daily backup on all the members of the team. The most simple and straight way for the backup is git.


Strict “in code Documentation” - 

In code documentation such as comments, Readme is important because it increases the readability of the code or the.

In Addition to that it makes the understanding of the code very easy for the people who join the team in future. They don’t need to learn this from anyone and it saves time and efforts of the team.


Standardize Comments -

Having discussed the necessity of the comments, It is also important to define the clear way of writing comments.

Comments should not be too short or too large and complex.

Comments are necessary does not mean adding comments on every line of the code.

Everyone should follow the same standards of the comments.


Make the exception handling a formal practice -

Handling the exceptions are important, but handling them in a standard way throughout the code is more important.

This handling can be through common handler functions, creating helper methods for common error codes & messages. It can also vary such as try-catch blocks, if-else blocks, resolving-rejecting promises in JS/TS, try-except in python, etc.,


Consistent process of reviewing and upgrading - 

No one is perfect, so there has to be some process or person to review the code of everyone. Reviewing makes it very easy to find bugs at early stages of the code. 

Review cannot only be done in order to eliminate threats of bugs & problems of code but also in order to upgrade the old code. It identifies the cracks in the code and can help improve the working but old code.


Writing something about software development was in my head for a long time and finally at least starting it feels good.

Please feel free to share your thoughts on coding standards and  give feedback in comments or in private messages.

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics