Skip to main content

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.

Comments

Popular posts from this blog

Google NCR

Google NCRMost of you would be knowing about this trick in navigating to Google generic website. But I just came to know only a few days before and hence thought I would share the information with others too.
Whenever you type http://www.google.com/, Google automatically tries to redirect you to your country-specific website. For me, it always redirects to http://www.google.co.in/ (Google India). But when we specifically want to navigate to Google Generic website for some reason, there are two ways to accomplish the same.Click the 'Go to Google.com' link at the bottom of the webpage that is displayed from http://www.google.co.in/To prevent this redundant click, you can opt to type http://www.google.com/ncr/ which would prevent the redirect from happening. The NCR stands for No Country Redirect. There is a brief discussion about this NCR over this forum.You may also like to check out Google help documentation regarding the country redirections from here.

Elegant 'MailTo' Replacement

Elegant 'MailTo' Replacement

MailTo tags have become a bane to all websites since spammers run spam robots which crawl the web to capture the email addresses, add to their catalogs and send spams to them. I just thought of sharing with others a simple JavaScript function which would trigger open the default email client instead of having mailto: embedded in the HTML Page.

Just have the following function included in your webpage

<script language='Javascript'>
function WriteMailTo(user,domain)
{
location.replace ('mailto:'+user+'@'+domain);
}
</script>

And whereever you want to invoke the mailto, just called WriteMailTo('user','example.com') and the user's default email client should be launching (if configured) without any hassles.

Contacts import utility from Web2Project to Addressbook

I have been using Web2Project for planning my personal and professional tasks for a few years now. Now I have bifurcated the tools into the following:

Project PierAddress Book The only issue I had was to import my addressbook from Web2Project to AB. PP is a different animal. It does not serve as a comprehensive candidate for addressbook and hence I needed this bifurcation. 
I wrote up a following simple script to import the contacts to AB. The pre-requisite for this script is to hop on to PhpMyAdmin, export the contacts as a PHP array and then  modify the path in our import script to whatever you downloaded from PhpMyAdmin.
Our import script would explode the entries as SQL scripts into the browser window. Copy them and execute into PhpMyAdmin AB database to have the contacts imported.

Script URL: https://gist.github.com/lavanyadeepak/5177500#file-import-php