Working with a stranger’s code..

deliciousdiggstumblefloatdzonePrint Articlecomments rss

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Almost all the developers are given an opportunity everyday to work with stranger’s code which can sometimes become a dreadful experience which is when they don’t follow coding standards.

Coding standards is an essential part in a programmers life. It lets you work freely, letting you focus on the real work.

What happens when the developer doesn’t follow coding standards?

  • Nothing is standard i.e the code, the file system, file names and etc.
  • The developer will become a barrier in a team. More work for the other developers.
  • The developer will take more time to write less code.
  • The developer code will not generate standardized documentation.

What happens when the developer follow coding standards?

  • A standardized documentation can be generated. A standardized documentation helps new / current developers to contribute/modifying the the code.
  • The developer fits in the workflow of team without any hassle.
  • The developer will take less time to write more code.

Clients never stick to the original developer, the original developer can die, get sick or just get fired. If the original code is unstandardized, the following developer will take more time to do less work until it remains unstandardized.

There are a lot of ways to standardize code.

  1. Follow standards which are made by large organizations such as Pear, Drupal or Java / Modify the standards which are made by large organizations with your own coding style.
  2. Use doxygen, PHPDocumentor, JavaDoc and etc, tags on your comment blocks which will generate standardized documentation for the client.

I follow modified version of Pear Coding Standards with doxygen tags on the comment blocks.

  • Pear suggests 4 spaces of indentation, I use 2 spaces.
  • Pear suggest line length of 75-80 words, I completely ignore the line length idea unless asked to do so.

The coding standards shouldn’t be followed only when writing server-side scripts. You should use them when you are writing any type of code.

 
Muhammad Haris

A post by Muhammad Haris

Muhammad Haris is a 17 years old freelancer web developer and designer. He loves writing programs and designing. His portfolio is located at www.mharis.net

Visit personal site

Subscribe to comments

RSS

 
 

4 Comments

  1. “The developer will take more time to write less code.”

    That can be a good thing too, if every line has been well thought out and the final code ends up being smaller, more succinct and more efficient then the extra time taken will be worth it.

    Unrelated to coding without standards, which is definitely bad practice and should be frowned on :)

    By Andrew Nesbitt, July 7th, 2008 at 11:40 pm

  2. I often feel like I’m working with a stranger’s code when I go back to sites I’ve done two years ago. Developing well-commented and well-thought-out code is a learning process.

    By Heather, July 8th, 2008 at 12:55 am

  3. [...] Working with a stranger’s code.. - Nice, succinct article that re-emphasises the fact that code isn’t just for the current coder. [...]

    By Design Inspirations for July 7th | isuckatdesign.com, July 8th, 2008 at 3:53 am

  4. Agreed points about coding standards. In a slightly different environment (C#/ASP.NET), I find that most commonly, developers often put classes in unintuitive namespaces. Kinda related to coding standards I guess - the correct organisation of code is very important too.

    Are things where you’d expect them to be?

    By Shane, July 11th, 2008 at 2:33 am