Coding convention or coding standards are the specific set of guidelines defined for a specific programming language. These coding conventions are used to cover the basic aspects such as indentation, declaration, naming conventions, following some programming principles, etc.
The coding standards are used for some of the following benefits –
- Software Maintenance - This can be used to maintain the software easily and can be cost-effective technique. No software is maintained for the whole life by the same author, so in order to easily maintain the code other than it’s author some rules should be followed. Coding convention improves the readability of the code.
- Software engineering – It is a process by which a project is designed. This process starts with collecting the specifications required to develop a software and then designing phase occurs, followed by a way in which the whole process is to be followed i.e., a model. A good is a software is always better if it is better even after the whole product is developed, i.e, the better understanding of code which helps in maintenance. It should be low of cost and delivered on time.
- Quality – A better quality software is a software which is easily readable because this will help the reviewer to provide the review for the software easily and faster. This will also help the maintenance team to maintain the software easily. Consistency use of white spaces will help the reader to read code easily and makes the code easy to understand.
- Refactoring – It is a process which is used to maintain the software where source code is modified in order to provide better readability and improve the code structure. Various things which refractor during this process is variable name, methods, making methods smaller, etc. This whole process is done while keeping in mind about the coding standards and naming conventions.
Some of the coding standards used are-
- Indentation and providing white spaces.
- While using operators on operands a single space should be given between operator and operands.
- All lines of code should not exceed 80 characters per line if there are some longer function names then it is allowed.
- When a function is called no space should be given between function name and the opening parenthesis.