CSCI 250 - Programming Practicum
Fall 2009
Code Reviews
In each code review, the programmer should discuss the following:
- List of features that work properly
- Test cases used for verifying each working feature
- List of known bugs
- Test case that triggers the bug
- Program (mis)behavior in that test case
- Analysis of the source code
- Design description
- What is the role of each class and interface?
- For each class and interface:
- To which other classes does it have a relationship?
- What is the nature of each relationship?
- Is each class mutable or immutable?
- Justify the mutability of each mutable class.
- For each method with a return value, does the method modify the
object? If so, to what purpose? Can it be rewritten to avoid this?
- How are the methods
equals(), hashCode(),
toString(), and compareTo() handled in
each class?
- For each inner class:
- Do objects of this class depend on the data from the outer class?
- If so, in what methods?
- If not, why not hoist it outside?
- Methods: Name every unsatisfactory method in response to each question. For each problem mentioned, suggest a solution.
- Do any methods lack cohesion?
- Do any methods have code at different levels of abstraction?
- Does every public method keep the object in a well-formed state?
- For each method with a return value, does the method modify the
object? If so, to what purpose? Can it be rewritten to avoid this?
- Java Library utilization
- What classes are you using from the Java API?
- Are you uncertain as to what some of the API method calls
in your code are doing? If so, where?
- Assessment
- What parts of the code do you understand?
- Is there any code duplication? If so, where? And
how can it be eliminated?
- Are there any magic numbers in the code?
- Are there any sections of code that could be rewritten to be
easier to understand?
- Does every nontrivial method have preconditions and postconditions?
- Are there any comments that are inconsistent with the code? If so,
describe each one.