Wednesday, September 24, 2008

Automated Quality Assurance tools VS. Manual QA

For this entry, I am comparing automated quality assurance tools with manual (human) quality assurance. I ran CheckStyle, PMD, and FindBugs on my CodeRuler code. I was amazed at how much warnings and errors that the automated quality assurance tools found compared to a fellow classmate found. Everyone is human, so there are things that we will see them as correct coding while the computer will see it as bad coding.

First I ran CheckStyle on my CodeRuler code. The automated tool generated 383 warnings/errors. Most of them were tab character, some of them missing Javadoc tag comments, and some were warnings of passing the 100 characters marker. Comparing this to a fellow classmate that checked my code, both CheckStyle and fellow classmate found the same errors (missing @param, @author, Javadoc comments, passed the 100 characters marker, and lines that contains tab character instead of spaces. I think the fellow classmate would give up if he has to find all 383 warnings that CheckStyle did and list the line number.


Next I ran the FindBugs. FindBugs did not find any bugs in the code, so that was a good thing. I mean the code worked and it did pass Eclipse’s quality check. Yeah, did not have to worry about FindBugs since it did not find any bugs in the code. I think the fellow classmate did not find any bugs as well, it executed fine on his computer.
Last I used PMD. PMD gave 34 warnings, 19 of them was first priority and 15 of them was third priority. Most of the warnings were for creating empty method and returning empty variables instead of nulls. The rest were avoid implementing this type of coding and instead use this coding. PMD is great in making the code readable and reducing the lines of code. Well the fellow classmate did find empty methods, and use if/else block statements, but he did say to re-code certain part to make it not as confusing.


Automated quality assurance sure beats out manual quality assurance. But there are some things that human can tell and computer cannot, vice versa. With automated quality assurance tools, it is less time consuming (that equals to saving money and headaches) compare to manual checking.

Using Ant and automated quality assurance tools

This is my first time using the ANT build system, and open-source automated quality assurance tools (CheckStyle, FindBugs, PMD). At first I did not know where to create new environment variables, got that out of the way after learning it must by created in Windows Computer’s properties. One of the environment variables that we have to create but was not on the ICS 413’s Standards page is JAVA_HOME – for people who installed the Sun’s Java JRE too with the Java JDK.

When I heard that Ant and automated quality assurance tools was going to save me a lot of time. I was pessimistic at first, like how will this going to help me. Well, it sure helped a lot; I was able to change come “obsolete” code to “modern” code. It gave warnings and also hints on how to solve them.


I was able to complete all the tasks successfully and was able to pass the verification test. The three easiest errors to correct were the checkstyle, findbugs, and junit. I had one hard error that I did not know what to do; it was from the PMD test. So I went to watch some television for a little while and came back to tackle the error. I discussed with a fellow classmate on the problem, and finally able to come up with a solution. There were errors ranging from basic, use Integer.valueOf() instead of new Integer(), to challenging, replace the empty catch exception block. PMD have a site that links each error to it. I think that is great, but I did use google.com to look for tips on errors that were not hyperlinks.


Ant is an excellent tool to have when using automated quality assurance tools and distributing source files to others. It should help me a lot with this assignment. Since there is no standards for programmers to follow, with the Ant build system and automated quality assurance tools it is useful when distributing to others.

Here is my distributable .ZIP file: http://sites.google.com/site/phillipkhlau/files/stack-klau4-6.0.924.zip

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.

Monday, September 8, 2008

Lessons learned from Code Ruler

I had problem communicating with my original partner, but I found out a fellow classmate (S. Sanchez) who did not have a partner to join our group. I was able to make progress with my partner on the assignment. We met up and were able to code the assignment. My partner was tackling the movement and attacking of the knights. We implemented some code from the code ruler website because we got stuck with our own code. I did the peasants – making them move, check if the land is already ours, if not then claim that land. I was able to communicate with my partner through AOL instant messenger.

Plan:
Our plan for the code ruler is to the have our knights to attack the nearest castle and take over that castle. From there we order the knights to attack the next nearest castle. With the each castle, we use them to make more knights and peasants. The peasants are used to cover land that is around the castle. We made unlimited knights, but we limited our peasants to 25.

The link the .ZIP with the javadoc and myRuler.java is: http://www2.hawaii.edu/~klau4/lau-sanchez.zip

The following table is the results of our ruler against the Random, Migrant, and Gang up rulers, all nine tests were one-on-one our ruler against each sample ruler.



lau-sanchez VS random

lau-sanchez VS migrant

Lau-sanchez VS gang-up

Test 1

694/2

656/4

261/146

Test 2

651/2

387/9

214/189

Test 3

399/26

441/18

142/234
















Lessons learned:
I agreed with the fellow classmate who said to start the assignment early. There was a lot of thinking involved to get the ruler to beat the sample rulers. This class does take a lot of your time, so time manage is a must to balance between school and personal stuff. My partner and I got stuck at the beginning, so we redo the assignment from the bottom up. Eclipse is excellent, all-in-one product. It made functions for me and I was able to create javadoc from it. Emacs and UHunix was great. Eclipse is better, makes my life easier.

Monday, September 1, 2008

Java-based Open Source Project

Overview:
My goal for today is to learn how to use and implement java-based open source systems, and to have a firm idea of how hard or easy is it to gain the “Three Prime Directives” for Java-based Open Source Software Engineering. The “Three Prime Directives” are: 1. the system successfully accomplishes a useful task, 2. an external user can successfully install and use the system, 3. an external developer can successfully understand and enhance the system.
For my java-based open source project, I chose ‘Art of Illusion.’ The project page from SourceForge.net is http://sourceforge.net/projects/aoi; the site for this program is http://www.artofillusion.org. Art of Illusion project is a simple program that gives users the ability of designing professional looking 3-D graphic models, textures, and animation. The developers of this project let users learn its features fast but still providing advanced tools for experienced graphic users to create high-quality arts.


Prime Directive 1: the system successfully accomplishes a useful task.
Yes, it does accomplish a useful task – designing graphic artworks. A user can shell out hundreds of dollars to buy a program that does the same thing, but the user can use this and still get the same results if it is done using the correct tools. The task for the project was to give users a fast way to learn how to design 3-D artwork without the consuming a lot of time like in a much bigger program. I tried out the program since I am into 3-d rendering and animation, it give me some decent artwork if I had to use it for a presentation. It was fast to learn for me to create a 3-D box, I can use that make a row of buildings if I wanted to.


Prime Directive 2: an external user can successfully install and use the system.
Yes, a user can successfully install and use the system. The installing part was really simple; almost anyone who has basic computer skills can do it. The project included an external installer that the user uses to install the program. Another thing is that the external installer creates an external uninstaller for users who wants to get rid of it. The manual (that does not come with the package but have to download it separate) gives a nice tutorial on what artwork I wanted to do. It has images to guide me each step of the way, so I am using the correct tools for designing my artwork. The table of contents is well put out for specific design. The manual was not included with the package, which is kind of bad since the manual should have been with the package. Users can get the manual by going to their website (www.artofillusions.) to view the online version or download the documents onto their computers.


Prime Directive 3: an external developer can successfully understand and enhance the system.
An external develop can somewhat understand and enhance the system. I think the comments in the source files was not a great help, some of them were only one sentence long which I think did not suffice what a function was doing. There is a developer’s manual for people who want to enhance the system, but it was not included with the source files. Developers have to go to the art of illusion website to obtain the manual. I think the manual give a detailed tutorial for each class or material plug-ins to offset the comments in the source files. I think an external developer still have to contact the system developers for a successful understanding and enhance the system. So I conclude that this system did not successfully fulfill prime directive #3.