Saturday, April 21, 2007

The Necessity of Coding Standards -- Building Efficient Software

The Necessity of Coding Standards -- Building Efficient Software

In this short discussion, I would like to highlight regarding the necessity of coding standards, their advantages, methods to adopt in following a coding standards, a few reference standards besides a couple of review tools that help us introspect whether we are following standards.

Necessity of Coding Standards

  1. Coding standards, as the name itself stands for denotes that it supports common shared view (aka) standardization of coding practices for a particular application development. This way, a new developer who comes on board or a fresher who joins the enterprise and takes up the application would find themselves comfortable enough to grasp the application logic without the necessity of the individual coder himself sitting with them and walking through the same. Not always the first-line developer can sit with the developer on job. The various parameters that affect are geographical, technical, chronological feasibility factors that dictate a restriction on the same.
  2. Standardization helps the application development to be process-centric instead of developer-centric. The developers can focus on the logic instead of understanding particular coding style trends.
  3. Standardization helps insulate regional, personal cultural differences and provide a formal approach to the application programming. For example, declaring a variable like int a, int b etc might show how much less experienced is the programmer. A good indicator would be like declaring variables like intDegrees, intMetrics etc.
  4. Standardization also effectively encourages new features to be incorporated as a breeze as it would be fun to maintain a well-coded and well-designed application. The development efforts would be minimal and deployment nightmares would be almost nil.
  5. Efficient and standard code reduces the cost of development, maintenance and support and helps the enterprise in reducing the running costs and make more profits too.

Going About Code Standardization

Standardization of code should not understood as a step near refactoring. The bad practice is that small organizations do it near the fag end of the project while delivering the same to the end client. A good standardization practice should begin right at the inception itself. There should be punctuated reviews of the code by peers and technical leads who can give feedback and ensure that these are included in the implementation. All said, the project plan must have a decent time component to accomodate such reviews as well.

A few organizations claim to run short of time and hence overlook coding practices. However, there is a saying that 'Haste makes waste'. It is better to be systematic and win the race like the tortoise rather than being hasty like the rabbit and losing out.

Reference Coding Standards

We would here give a partial list of reference coding standards for various languages. These are, in no means, complete list. Furthermore, your enterprise might have a standard already in place. The bottomline is that the team should get to gether to represent the application in the single wholistic fashion rather each one going in thier own direction.

  1. .NET/C#:
    1. C# Coding Style by Mike Kruger
    2. Secure Coding Guidelines for .NET Framework
    3. Program Structure and Coding Conventions
  2. Java
    1. Coding Conventions for Java language
  3. C/C++
    1. C Coding Standards
    2. C++ Coding Standards
    3. GNU Coding Standards

Are we going on the right track?

All is fine. However, we ought to have a reckoner or an introspection process periodically to check out with ourselves whether we are going on the right track. I would like to share a couple of tools that help us periodically check up our code whether it adheres to standards and brings out the variants/deviations if any.

  1. Macadamian Code Review Checklist (They also provided a rich Visual Studio AddIn to detect the code. However, currently this tool seems to be not available on thier website)
  2. GotDotNet FxCop

Summarizing

I hope that this little discussion would have been useful to bring out the talents hidden in the developers in the best represented implementation for the long run and long term potential benefit of the organization. Let me know your feedback and information that you would like to share with your readers.

No comments:

[Imported from Blogdrive]Online Virus Scanners

Online Virus Scanners Virus Scanners are no longer difficult to install, tedious to configure. There are easy to use Online Virus Scanne...