ireckon blog

our team offer up their best tips and words of wisdom

Ireckon.com Web Design Brisbane Australia

April 2008

Coding Standards

Posted by: Blair on 4 Apr 2008 @ 12:22 pm Category: Programming and Coding for the Web

My lecturers were always harping on about coding standards and using comments in my code while I was at university. I usually went back after the fact and added comments for just about every line of code and this seemed to appease the lecturers. But, I never understood why they went on about it so much and considered it almost as important as whether the code did what it should.

Of course, 20/20 hindsight is a wonderful thing and I now understand what they were on about. When you are just mucking about programming at home or for uni you are likely to be the only person to ever look at the code and you know what it does so its never a problem.

However, once you start working as a professional programmer you are suddenly in a position where you have to update or maintain other people's code and its then that you suddenly realise the importance of coding standards.

Obviously, 'coding standards' is a bit of a misnomer as they are not usually standard across the entire industry but, as long as an organisation has coding standards and its programmers largely stick to them it certainly makes it a lot easier to read and understand code then it would if everyone just churned out their own special brand of gelatinous blob which passed for code.

So, next time you are getting your hands dirty and doing some coding please try to keep in mind the following guidelines:

  • Use comments to explain what the code is doing, especially for complex operations
  • Indent your code so that the scope of the code is clear. When indenting you can choose to use either tabs or spaces but, whichever you choose, ensure that you remain consistent
  • Use meaningful variable and function names that concisely describe the variable or function's purpose
  • Use functions and methods to avoid repeating similar blocks of code over and over
Happy coding.

Comments



Leave a comment

Enter code you see in image

Web Developement Blogs - BlogCatalog Blog Directory