what is Coding standard in programming languages?
When any new software engineer start working on the coding part then their is always some question in his/her mind, its does’t matter that its a PHP Programming, Java Programming, ASP Programming, Dot Net Programming or any other programming like perl, python, ruby, SAP, VB.Net, C# etc…
What is coding standard?
why we use this coding format while we can do it easily in some other way?
why not i use my own coding style?
Almost each company use and follow some coding standard based on their best practices. we can not say that every company have their own coding standard but we can say that every company follow different coding standard.
What is advantages to follow the coding standard?
– You are not only the programmer who do the code in any company, there are many programmer working on it, so its easier for each programmer to understand what code you wrote for specific module.
– Software Engineers change the job when they get some good offer from other company, so when any new software engineer join then he/she can easily understand the code and continue the project from where you left.
– When you follow some coding standard then you are use to with that which will prevent you from some common mistakes.
– Its easy to maintain the quality of software as well as its achive the industry standards.
– Sometime projects are too big and running upto 2-3 years, during this type of projects its easier to understand the code when you revise it for some time being of further development.
Some common Useful Tips used by all coding standards.
– Comments : When you see any controller or function then always write some comments which indicate that this function or controller for what purpose and where its useful in the system.
– Tags : Always use full tags rather then short tags, this will be helpful to run the application with out configuration of tags from one server to another server.
– Variable Names :
– Always use lower case to define all local variables
– If variable is combination of two word then use ‘_’ (Underscore) to saperate the words.
– Use upper case for all the constant variables.
– use prefix with a ‘g’ for global variables and prefix with a ‘s’ for static variables.
– Blocks : All the condition and looping blocks of statements should be aligned properly, so we can easily differntiate it from other code.
– Line of Statement : Always use one statement per line, do not write two or more statement in one line.
– Functions Name or Method Name : Function name and method name is relevant with the functionality of the function. For Example, you can not give function name ABCD for the function who is wrote to do the maths functions.
There is many other points which is used in the coding standard but all the above is some common points and then you need to follow the company standards. For example some company prefer to write author name on each file or function.