CS 372 Spring 2016 > Notes for February 29, 2016
CS 372 Spring 2016
Notes
for February 29, 2016
Code Review (cont’d)
We did a code review exercise in class. See the handout In-Class Activity: Code Review.
Some conclusions.
- Code review is serious work.
- Code that looks good, at first glance,
may still have serious problems.
- I thought the code presented in the in-class activity generally looked great at first glance. (Of course, I might be a bit biased here; you can feel free to disagree.)
- Flaws in the design need to be dealt with differently
from errors in the implementation.
- In the in-class activity, the design document specified a function that violated the coding standards.
- Spending an hour going over 200 lines of code
might seem like a very slow pace.
But often it is not.
- For example, in the in-class activity, groups spent 20 minutes going over about 20 lines of code and about 65 lines of associated unit tests. I observed that a number of groups were still discussing the code when I ended the activity.
- On the other hand, we should note that, in this in-class activity, some of the time was necessarily spent familiarizing yourself with the project. But in a typical real-world code-review situation, the reviewer will already be familiar with the project.
- It is important for unit tests to fully
test the associated feature.
- In the in-class activity, the code had a couple of serious bugs, at least one of which could easily have been caught with proper unit tests.