Back to Homepage

Credit: public domain

Code reviews

Andrew Begel

As you read in the verification chapter, code reviews are one of the more popular, effective ways of verifying software. Today we're going to practice doing a code review.

We're going to use a group checklist method of code review today. Checklist methods are simple analytical inspection techniques for remembering to verify multiple dimensions of code for different aspects of software quality. Here's the checklist we're going to use:

There is no official, standard, or best set of guidelines to check against. The right guidelines depend on the qualities that matter for your software project.

Form an ad hoc group of three. Then, without executing this JavaScript code, check it against the checklist above:

function face(centerX, centerY, radius, exo, eyo) {
	canvas.beginPath();
	canvas.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
	canvas.fillStyle = 'yellow';
	canvas.fill();
	canvas. lineWidth = 5;
	canvas.strokeStyle = 'black';
	canvas.stroke();
	// aye aye captain
	canvas.beginPath();
	var eyeX = centerX - exo;
	var eyeY = centerY - exo;
	canvas.arc(eyeX, eyeY, eyeRadius, 0, 2 * Math.PI, false);
	var eyeX = centerX + exo;
	canvas.arc(eyeX, eyeY, eyeRadius, 0, 2 * Math.PI, false);
	canvas.fillStyle = 'black';
	canvas.fill();	
	// mouth
	canvas.beginPath( );
	canvas.arc(centerX,centerY,50,0,Math.PI,false);
	canvas.stroke();
}

Write down all of the problems you find. We'll come back together as a group to identify the kinds of problems you found.