10 simple things to check while doing code review :
Code review is also one of the important task of the coding cycle, code review is very beneficial in many senses such as it can avoid any regression, it helps in maintaining quality of code, helps to avoid duplicate code and many more.
Now lets see which 10 things you need to look for while doing code review (some of those things you might know)
1. No compile errors :
First and most important thing to look is whether code is compilable.
No errors or warnings should occur when building the source code or code is changed.
2. Understanding of code
It is very important to know what changes are exactly done and for what reason.
3. Expected Output
Another very important part to check is the output of the code, is it as expected??
4. Exception handling
Next point is does the code has done correct exception handling? are there any null pointers handled , array index out of bounds cases handled? You need to check these carefully while reviewing the code.
5. Coding conventions
Coding conventions are very useful to maintain readability and usability of the code. So it is important to know the coding conventions have been followed. Variable naming, indentation, and bracket style should be used.
For comments you must check whether
1. Does constant variables are properly commented?
Each global variable should indicate its purpose and why it needs to be global via comment.
1. Does complex changes or optimizations are properly commented?
Are complex methods and optimizations should be commented to know why and how these changes are done.
Does unwanted and commented code have reason?
Reason for unwanted and commented code should be clearly documented with reason or bug id if available.
Are all variables are properly initialized. Are all defaults are properly set?
It is very important to carefully monitor which code is going to execute at start-up (e.g. at the start of tomcat, or start of UI or start of any web service etc) and which is going to be executed in loop or multiple times, optimize the code which is going to execute more often. Does code use loop unnecessarily multiple times? Consider using a different thread for code making a function call that blocks the operation.
Check following things to make code thread safe :
Are all global variables defined are thread safe?
Are all objects are thread safe?
Are synchronized method used at unwanted places?
Are locks are properly released?
10. Bug and code changes
Last thing you must check is with the code changes the bug is properly getting fixed and at all possible occurrences of the bug?
Hope you find this article useful. If you liked it please consider sharing it or if you want to add it more you can add it via comments.