Code reviews and code changes become time consuming when there is no discipline followed during the coding process itself. The discipline is more around following the standards itself. The following are the most possible causes I could think of in lack of discipline following the standards.
- The developer is unaware that there exists a coding standard.
- The developer understands there is a coding standard but does not know or understand what those standards are.
- Most important, very lethargic to follow the standards in the first place. This is the most common mistake I have seen. Following the standards need to become a habit, so that at one point you really don’t need a standards document to refer to, it comes automatically like how you don’t realize that you are balancing when you ride a bike.
- Procrastination to address standards and finally missing implementing it. Most of the time developers write a test code to make sure that the logic works. But finally that same code gets inserted into the actual code. My question is why not code to standards even while writing the test code? If it is useful, you can directly embed that in your code. If it is going to be a scrap code, so what you are making sure that you are getting the standards habit.
- Documentation - I know this is a left out area, why because when the thought comes “It is the logic, what is there to document it? anyone can read it and understand” The truth is, no it is not easy to understand, the approach and thereby logic differs from one person to another. A lot of things go in your mind when you code, the reviewer or another developer reading it will not know these. This is what I recommend on documentation. You don’t need to have a formal comment statement, make it casual, and add some funny text in between and at the same time try to convey the message. If you don’t cover documentation when you code, it will pile up and you will not be able to do it at the end. I have seen developers think for sometime for their own code when I ask them to explain the logic during code review.