What are Code Standards?

code standard

Following the “best practices”, following the set of “programming guidelines”, “code reusability”, “programming styles”, “code readability”, “code modularization”, providing proper comments.

Students or Programmers are in the early stages who have a general understanding of the language, and trying to improve their code readability, maintainability, and so on. Then this is a right page for you to learn the coding standards.

Basic Programming Skills

There are certain basic programming skills which can be applied to the program to make it more readable and maintainable.

Indentation and whitespaces

The set of codes should be properly indented with whitespaces meaning normal space or tab space to make it readable and better understanding.

  • Spaces between the statements
  • Inserting space before curly braces
  • breaking the long lines with proper breaking syntax
  • Space after comma
  • Blank lines between the different chunks of code
  • Space around operators
  • No space before semicolon if your programming language has that syntax

Naming Standards

All function names, object names, and variable names should be in proper case with underscore or hyphen separations. A few naming standards are as follows:

  • Camel Case – It is the most widely used naming standard in software development. Example: variableName
  • Pascal Case – It is the second most widely used naming standard in software development. Example: VariableName
  • Kebab Case – Name should be in lowercase and it is separated with hyphens. It is a commonly used naming standard. Example: variable-name
  • Snake Case – Name should be in lowercase and separated with underscore. Example: variable_name

Code Standard Validation Tools

  • PC-Lint
  • AdaControl
  • Helix QAC
  • Checkstyle

Share this: