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
- 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.
- 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.
- 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.
- 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.
- 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.
- .NET/C#:
- C# Coding Style by Mike Kruger
- Secure Coding Guidelines for .NET Framework
- Program Structure and Coding Conventions
- Java
- C/C++
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.
- 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)
- 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:
Post a Comment