Monday, September 15, 2008

CodeRuler Review

I am reviewing John Ly’s & Yasuyuki Kaneshige’s code for the CodeRuler program. Just for people who do not know what the CodeRuler program is. CodeRuler is a Java game that uses Eclipse Editor. Programmers control their knights, to fight and capture castle, and peasants to claim land. Programmers code the knights’ and peasants’ “duties” in Java. CodeRuler will run their code and that is where the game begins against the programmers’ ruler and the CodeRuler’s own rulers.

I downloaded John’s and Yasuyuki’s ZIP file. Place their code into CodeRuler and ran it couple of time against CodeRuler’s rulers. Their ruler did an excellent job against the CodeRuler’s rulers. I was using Capture Castle Ruler, Split up Ruler, Gang Up Ruler, Smart Split Up Ruler, and Pawn Evasion. Comparing their strategy with ours (Lau-Sanchez’s Ruler), their plan works well than what we have.

Taking a look at their JavaDocs, they are clear and concise. I was able to understand how each method work. Their documentation comments are to the point and not ambiguous. The class is structured logically, broke up the task of the knights and peasants into their own methods and not both in one method.

File

Lines

Violation

Comments

MyRuler.java

3

EJS-100

import java.util.Iterator is never used in the code.

MyRuler.java

10

EJS-46

Do not have @author and/or @version in the documentation comment.

MyRuler.java

16

ICS-SE-Java-8

Use this instead:

ArrayList<\IObject\> enemies = new ArrayList<\IObject\>();


**NOTE: those "\" not suppose to be there

MyRuler.java

24, 25

EJS-34

Do not need those comments if it is already in the comments couple lines above it.

MyRuler.java

19, 53

EJS-35

Use documentation comments instead of standard comments for comments above methods.

MyRuler.java

27,29,31,*

EJS-31

Gave the numbers a constant name so the code speaks for itself

MyRuler.java

180,187,189,196,198

EJS-76

Use block statements for the if and else.


Conculsion:
Even there was violation of the Elements of Java Style book and ICS413 standard, the code was still readable and concise. Should have some white spaces here and there, but overall I was able to read the code. The comments within the methods were useful, if I was to maintain this code I will be able to understand it with the help of the comments they had.

No comments: