Saturday, April 30, 2005

Code Reviews

Do code reviews help. Are they some sort of magic cure, a panacea for all evils that affect us ?
Some would like us to believe so. What do I think. Having worked in a SEI CMM Level 5 company, I couldn't agree more with Taran,

I'd like to think that code reviews have value simply because I
have personally wasted a lot of valuable time in them, worrying about
alphabetizing variables and so on. But that doesn't make it so, and
nobody really can prove whether they are worthwhile are not.

Code Reviews tend to be silly things in corporate settings. They
argue about code formatting, how many spaces equate to a tab, and so
on. My personal favourite was getting trashed for not alphabetizing my
#define variables by NAME instead of what I had done - alphabetizing by
variable type, then name. Yes, these things are really done in
professional shops. Also, if nobody else in the room is familiar with
the history of the code and the function of the code - not to mention
the dependencies, and so on - is it really a code review? How can you
analyze 12 lines of code in one class when you're dealing with a
complex software system with high interaction? Not unless the people in
the room *know* the code - all of it. Unlikely.

Read it all here

Do I review others code ? I do, but that is when it starts failing.
(I do read code written by experts a lot , not for reviewing, but to learn how to write good code. )

Do I like others reviewing my code ? They are most welcome, provided that they point out bugs, not formatting issues. I have a set of personal preferences I have developed. Any attempt to introduce a UNIFORM coding style (guidelines) is just that, like introducing a school uniform for the programmers. I would change my coding preferences, my indentation style and my variable naming style the day you convince me that yours has some tangible benefits, well worth the efforts I put in. Till that day, I code the way I do, so may you.

The best way to overcome indentation issues and have a uniform look and feel is to use a program like indent, because the debate over tab and spaces and braces and newlines is an eternal one.

No comments: