Search This Blog

Thursday, May 28, 2009

Coding Standards - Part I

Some of you would be thinking why do need coding Standards. As a developer, I would like to highlight few points which will definatly convince every developer why we need to follow coding Standards.
The best applications are coded properly. This sounds like an obvious statement, but by 'properly', I mean that the code not only does its job well, but is also easy to add to, maintain and debug.

Why do need coding Standards?
1)80% of the lifetime cost of a piece of software goes to maintenance.
2)Hardly any software is maintained for its whole life by the original author.
etc etc...
Code conventions/Standards improve the readability of the software, allowing engineers to understand new code more quickly and thoroughly.

1)Coding standards are great -- but how do you decide which standards you want to apply, and how they will be defined? When you formulate your ideal coding style, you should think about these points

2)Can you actually read the code? Is it spaced out clearly?

3)Do you separate blocks of code into 'paragraphs' so that different sections are
easily defined?

4)Are you using indentation to show where control structures (if, else, while and
other loops) begin and end, and where the code within them is?

5)Are your variable naming conventions consistent throughout the code and do they
briefly describe that data that they'll contain?

6)Are functions named in accordance with what they do?

7)If you come back to the code in a few weeks or months, will you be able to work
out what's happening without needing to look at every line?

8)How are you commenting the work?

9)Have you used complex language functions/constructs that are quicker to write but
affect readability?

No comments: