12 May 2008

Bracing annoyance at work

Everyone working as a programmer has their fair share of annoyances. I have mine too. Sometimes its something simple like the design of everyday things that gets to you. At other times its the code editor. Of late I carry a silent grudge whenever I deal with writing or modifying some piece of Java code.

It has nothing to do with Java per se. Java is a great language and has simplified and glorified programming to a great extent. Its relating to this requirement of writing code according to standards. Again I haven't got any grudge against adhering to standards but some standards just irk me at times. For example - take this piece of coding standard - they say its a Sun Coding convention.

That of laying down opening braces "{" on the same line as the related class / method declaration or loop statement. I fail to understand why its a standard in the first place. It goes against visual alignment of code blocks. If mean - if opening & closing braces are aligned on the same column - it makes it far more simpler to discern and understand code blocks.

Lot of developers I've spoken to sympathise with my argument but say that we should do otherwise since its an accepted standard. But then - have the folks who designed this standard - put in some explanation anywhere as to why it is beneficial ?

As of now, my code editor (I use Eclipse) allows me to override this standard and put in mine - the old fashioned way - like it was in C - when i learnt my programming. But I still remain puzzled as to why folks have kept this as a standard.

1 comment :

  1. Coding convention can culminate from many different school of thoughts.

    A standard should also keep in mind the ease of use and readability.

    Recently while reviewing a piece of code i came across the same awkward standard and took some time to review the highly nested loop. It would have been easier for anyone if it had been in a column 'block'.

    It all depends how you start with baby steps and learn the ABC (if-else-while) of a language.Or better how your client expects you to frame the code with Sun's coding Standard.Bunch of retards!Sorry for being harsh ;)

    What works for you , works for you!
    What does not work for you , chuck it! :)


    Cheers!!

    ReplyDelete