Code Reviews are Important!

A few months ago I was reviewing some Visual Basic .NET code from a production application and I came across the following little gem.

1Dim variable As Integer = CInt("1000")

There are so many things one could say. It just boggles my mind…

I admit, this code will not cause any problems, but it is low quality and sadly humorous.

Unfortunately this one line of code indicates a general lack of professional coding, and thus immediately raises concern for other code that is actually critical.

How and why did this code get into production?

Perhaps a static code analysis tool wasn’t even used. (Perhaps static code analysis tools do not highlight this as an issue - I haven’t tried!)

However, static code analysis tools will never completely identify all types of low quality code or bugs, and this is why I maintain that all code, regardless of who it was written by, should be reviewed by a more experienced peer before it passes through to the next stage of testing or release.

Quite simply, it is a matter of professionalism. If a client saw this code and understood its low quality nature, I am sure they would not be happy.