Performing a software review, something vital in the life of any programmer. Something we do often, maybe to help a friend or even to review our own code. Reviewing is vital to ensure that we don’t have unexpected bugs due to typos or stuff we missed. In the industry, they also perform software review but in a more organized way, with certain activities and roles that I will be talking about in the following paragraphs.
What is a Software Review?
The main characteristic of a software review is that it helps us detects errors, bugs and defects in our code, and not just that we also ensure that it follows good practices. We can perform it simply by reading our own code or someone else’s a code, it’s a matter of examining it deeply so we can detect which lines are wrong in the code and quickly fix them. That’s one main advatange that it has over testing, since on testing you can detect that your code is wrong in many different ways, but to know where it is wrong you have to debug it, meanwhile in software review you quickly fix it, so you save a lot of time that would be spent on debugging.
There are many different types and subtypes of Software Review: Mainly Peer Review, Software Management Review and Software Audit Review. But we will be talking just about Peer Review and Code Inspection which are the most used in the industry.
This type of review is the one used in pair programming and is one of the most common types of software review. There are two main roles: The driver and the observer or navigator. The driver is the one who is writing the code, while the observer is the one reviewing it. These two persons are always switching roles continously, so the driver is never the driver for the whole Pair Programming Session. The navigator is continously reviewing each line, and ensuring that it’s following good practices, detecting bugs or problems that may arise and considering how it may function as a whole. This allows the driver to focus completely on the task of writing the code and making sure that it works, without worrying about stuff that the navigator is looking for.
Software Inspection is one of the most rigorous proccess of software review. It has two roles: The developer and the Reviewers. The process starts by the developer explaining the product created by the code, the requirements its trying to solve, and any questions that the reviewers may have. The developer then exits the room and the reviewers start to carefully examine it to detect any defect the product may have, after that they put all the data they collected in the inspection on a document and tell the defects detected to the developer along with ways to fix it. The one that tells this information to the developer is called the reporter which is chosen by a moderator which is the one that mediates everything between the reviewers and the developers. One main advantage of this process is that it can be performed even if the code isn’t over, because since the ones performing the review are humans coders they have the experience needed to detect common bugs or mistakes in the code without having specific tests.
There are three main metrics that must be carefully examined while performing a software inspection:
- Defects; Detecting the amount of defects, and why they arised is important to ensure that they don’t happen in the future.
- Effort: It’s important that the inspections are time effective, so they don’t end up bigger than the time spent on developing. To achieve this is important that the developers comment their code and use good practices like naming the variables relevant names and not using magic numbers.
- Deliverable size: Inspections must be done every certain time, but in that time the deliverable that will be examined must not be too large or else we will fail on the effort metric since it will take a long time to carefully examine it.
Software review is always important, and it doesn’t even have to be hard. Just by performing good practices, doing good comments in your work and making sure that you understand how your code work will make it easier for the ones reviewing it and performing inspections on it, which on a larger scale will make your whole code team much more productive!