How many people have actually gone through a formal code review? Not a little chat with someone to have them look at your code, but a formal code review where everything in your application is examined, from the names of the variables, to the indenting of your code and even the ordering of comparisons in IF statements.
I'm betting that the vast majority of you who don't know the difference between VS COBOL and COBOL II have never experienced a formal code review. In fact, even those of you mature enough to know that reference with regard to COBOL may not have experienced a formal code review, although you've probably gone through an informal review.
Personally, I kind of like the idea of a code review, particularly after having seen some of the code that we migrate into production. It's not so much that the code is wrong, because it's not, it's more along the lines of messy. Much like your mother telling you to clean up your room when you were little (or, for some of you youngsters, last week), I'm telling you to clean up your code. Proper indentation, something that Visual Studio takes care of for you, is only one aspect of cleaning up your code. Other things you need to do in order to clean up your code is:
- remove negative logic
- reorder IF conditions so that the one most like to fail is first
- reduce the size of methods to a more manageable size
- make your variable names meaningful and consistent
There are literally dozens of things you could do, but you will probably do none of them? And why? Because there is no code review process in place. As a result, we end up with methods that are hundreds, if not thousands of lines in length with variables that make no sense in terms of naming and poorly formatted so you have to read every single line to find out what is going on.
I pity the person that needs to support the code after you have gone.
No comments:
Post a Comment