Search This Blog

July 13, 2007

Good coding standard

Every programmer can write good programs quickly using different languages such as C#, VB.NET, C, C++ or Java. Everyone has their own coding style and it is hard for them to follow the good coding standard in different companies.

If you worked for many companies before, your supervisors might ask you to follow their coding standard when they did the code review. You should get in the habit of following their instructions and try to get the task done soon.

When my previous supervisor, Eric Johannsen in San Diego did the code review, he read source codes line by line carefully. His basic points are as follows:

1. Follow the test cases written by SA in Enterprise Architect (EA) and use C# and NUnit to write your own source codes.

2. Code reuse all the time. Make the test cases run quickly.

3. Remove the source codes you commented out before if they are not used any more.

4. Make the source codes clear and clean.

When Jeff Papiez, a senior test developer I report to directly at Microsoft, has the code review , he reads source codes very carefully. His basic points are as follows:

1. Every class needs a header comment block where you must describe why you need this class.

2. Function names should be pascal-cased.

3. The arguments inside the function should be camel-cased.

4. Function names should be meaningful and make sure the spelling is correct.

5. If classes contain only static methods, make the class static as well.

6. Code reuse all the time.

7. Make the source codes clear and clean.

It is smart for you to collect their coding standards and let them become yours. Your coding standard will be much better than ever.

No comments: