Saturday, February 12, 2011

Do you really need a Code Beautifier ?

A food of thought! As a good developer, do you really need a Code Beautifier?

This thought came to my mind when I was reviewing my friend's code which was not properly intended for whatever reason and appeared to me as if scribbled on a paper. Soon I got frustrated comprehending the code with my brain muscles stretching out beyond their limits. When I asked the reason behind improper indentation, I got an answer (rather a question) - Do we have a good code beautifier which would properly intend the code without human intervention? That was an unexpected answer to me. There are certainly a lot of paid and open source code beautifier tools available, but do we really need them when we write a code?

Why can't we make it a good practice to properly intend the code when we write? Almost all IDEs provide good facility to have proper indentation and formatting. Why am I emphasizing so much on this? In my opinion, a good readable and logically structured code is necessary not merely for outlook. It actually reflects your mind - your attitude, discipline and neatness. This also brings a very important aspect when you are collaborating amongst your development team.

Yes, when you download a third party code and if that code is not properly formatted, then the code beautifier tools play a good role in making the code clean and readable. The code beautifiers are meant for existing ugly code faces, they are not meant for fresh development!

The ultimate message is - whenever you are creating something, be it a code or anything... make it always beautiful .... :-)

1 comment:

  1. I think your friend need to understand the conventions of writing code for that language, be it PHP, Ruby or Java. I understand your concern and yes you are right. Since being a developer not only mean you should right proper logic using a language and tests around it, but, it also mean that you are following conventions of writing code in that language.

    When I was a LAMP developer (my early days as a developer), I asked the similar question in the team and with a little brainstorming, we print out the conventions on paper and post it in front of the developer's system. So, every time for first week, we write a line of code, we cross check with the checklist. For first four week we used to do peer review.

    I hope this might help!