Sunday, September 14, 2008

CoderRuler Review

Introduction
The CodeRuler review assignment give us an opportunity to analyze code, from the CodeRuler assignment that was written by other students in the class. The review also, exposes the class to detecting and understanding violations of the course's coding conventions.

Team Reviewed and Link to their code
du-okada-ancheta

Links to their blogs
John Ancheta
Anthony Du
Creighton Okada

About
du-okada-ancheta's code
The
du-okada-ancheta's code is well organized despite having three different authors. The method structure within the MyRuler class is laid out in a systematic way. The way methods are lined up it seems to follow du-okada-ancheta's strategy of having enemy knights chase runaway peasants. The methods appear to perform each task efficiently as possible. I especially like the knight protecting the castle, a nice addition to the assignment, very cool.

JavaDocs
The team of
du-okada-ancheta's MyRuler.java lacked a simple statement that summarizes the code's operations. However, the team did provide bullet points for what each object is suppose to do as the program runs. Several methods lacked information on parameters and return type.

The Code
Overall, the coding was well done but there were some conventions that were missed. The instance variables should have a new line separating each declaration. Also, '}' should have its own line where some conditional statements had an 'else/ else if' preceding a '}'. There were some naming convention errors, some variables lacked appropriate titles, instance variables and methods calls were missing 'this'. Other than the issues with naming and coding conventions, the code was readable and easy to follow.

Findings

FileLinesViolationComments
MyRuler.java183,185,210,*EJS-5Indent nested code, each '}' should have its own line.
MyRuler.java230,356,358,*EJS-7White space, new line after each new instance variable.
MyRuler.java105,136,137,*EJS-9Variables need a meaningful name.
MyRuler.java139,141,144,*EJS-29Need to add 'this' before calling instance variables and methods
MyRuler.java7EJS-41Need a summary to describe the application in JavaDocs.
MyRuler.java99EJS-46Need version number and date in class comments in JavaDocs.
MyRuler.java200,201,284,*EJS-54Need comments for parameters in JavaDocs.
MyRuler.java353,564,766EJS-46Author's name in class comments only.

Conclusion

Aside from the naming and format conventions, the code of du-okada-ancheta's was well written. The team of du-okada-ancheta had a decent strategy which has them beating the toughest pre-made opponents in the game. After looking at du-okada-ancheta's MyRuler.java I wish I could re-code and have my methods do a better job at conquering the opponent.

The CodeRuler review was a decent task which made me realize some of the coding and strategic errors I made while putting together my team's version of MyRuler.java. So for the next coding assignment I will do a better job at implementing error free code.