Tuesday, September 23, 2008

Ant Lab

For this assignment we were to use some automated Quality Assurance (Q.A.) tools on a previous group assignment, CodeRuler. Some of the Q.A. tools the class is using are checkstyle, pmd, and findbugs. After processing the CodeRuler code using the Q.A. tools and seeing the results, we were given the task of comparing those results with the results we got from our peers in another previous assignment.

Checkstyle showed most of the same results our classmates caught. A lot of the errors both caught were formatting errors, the use of 4 character indentations and exceeding 100 characters. One error that checkstyle found that our classmates did not find was some white spaces not preceding a squiggly bracket. The pmd results illustrated 2 types of errors that our peers did not find. The errors were to avoid using implementation types, ArrayList, but to use the interface instead, also to avoid using Avoid if (x != y) ..; else. The last Q.A. program was findbugs, which it did not find any errors at all.

Comparing all the results of the Q.A. programs to our peers, I see that there are some formatting errors that a human can miss that an automated program can find. Some of the recommended solutions that were suggested by pmd were good, but would increase the length of lines of the MyRuler code. Also the Q.A. programs could not discover some logical improvements, a peer saw that two methods were structurally the same and could have been combined to reduce methods. Another error our peer found was the use of single character variable representation. The use of Q.A. programs and manual reviewing both have their advantages and disadvantages, but I see that Q.A.s can pick up errors that a manual check might miss and that manual checks find logical and structural errors that Q.A.s won’t come across.

Stack

This assignment is intended to introduce us to the use of automated Quality Assurance (Q.A.) coding analysis tools. Some of the tools we will be using are pmd, checkstyle, findbugs, and junit. These will help show us potential development problems and solutions when implementing a program. All the Q.A. tools will be used by another tool called Ant, to initialize the checks. Ant is a java based open source tool that helps programmers build and create packages for distribution of the program. We were given the objective to use these tools on a prewritten program, Stack, by our professor.

Task 1

The first task was to install these tools into my computer and setting system environments to make them accessible for other programs to use. Then to use Ant command lines initialize the Q.A. tools on the Stack program.

Downloading the Q.A. tools and installing them into a subfolder in the C drive was no problem. A dilemma I had was setting the environment variables. When browsing through a few of the manuals I got rather confused, setting the variables in the XML files or setting them in the computers system environment variables. This setback was clarified by Clayton, a classmate, during our class’s Ant Lab. He showed me what I did wrong and a temporary solution to a problem with running the Ant command lines in my computer’s command prompt. Later Ronn, another classmate of mine, saw and explained that I set the environment variables to only being of local use to my account alone and not making them used by the whole computer itself. Once that problem was solved I was able to use the command lines and see all the problems that the Q.A. tools found in the Stack program.

Task 2 and 3

For this task we have to duplicate the Stack program, but with some changes to the build.xml file and to rename the top level folder. Also for this task we had run Ant with the Q.A. tools to find the problems within the code and this time to solve those problems. Running the command lines to initiate the checks for errors was easy, since it was done in the previous task. Some of the solutions to the errors were given by the Q.A. tools, such as making a variable final and using method within a class. The other solutions were not as clear as others, such as use of the fail tag, this was because I was not familiar in using that tag. For errors such as those, I searched through Google on solutions, which were very helpful.

Once all those errors were fixed I ran the verify command line, which stopped once it came to checking for errors using EMMA and prevented the program from being built. I saw that I have not installed the Q.A. tool EMMA, but once I did the verify command ran smoothly with no fails. I could have avoided this error by editing the verify.build.xml file by erasing the importing EMMA and altering the task of compiling with EMMA. The dist.build.xml was the last file to run with Ant, which packaged the entire project into a zip file and named it according to how it was designated in the build file.

Impression of Ant

Using Ant was not new to me, in a previous class we had the chance of using something similar, Make. The difference I saw between the two was that Ant, along with the Q.A. tools, picked up on errors and gave possible solutions. Ant is a very useful tool and can see that why it is best used for big projects and also using it for open source programs.


My distribution results of Stack

Sunday, September 14, 2008

CodeRuler Review

West and Shum’s Code Ruler game strategy is very good. I like how they split their offense into two groups, one attacking enemy knights and the other to capture the enemy’s castle. Also taking into account if the group that is assigned to attack the knights first is dead, the other team will set its next priority to enemy knights after it was taking enemy castles. The approach they used for the peasants is very well thought out, having them occupy available land then looking to the occupy land that belongs to the enemy. They’re overall plan for the assignment was superbly designed.

Comment Overview
The use of comment content was very well used, making parts of the code easier to understand. Also using end closing brace comments when they had a complex nested control structure, which made it unproblematic to follow.

Javadocs
Their javadocs gave a good complete description of the program. It gave good details to understand what each method's function is in the game and also what the parameters are that’s being passed in.

Logic and Structure
The method logic was good throughout the code, but the attack() method could have been named better to show how the function is described in the javadoc. Since the attack() method was to tell the knights to move aggressively, and also they had another method which was to tell the knights to attack.

The class structure was well designed, most of the main function of the knights, peasants, and castle was organized well. They first split the knights into the 2 groups then having them move to a specific manner, then calling the oderPeasants() method for the peasant movement, and lastly controlling how much knights or peasants to produce.

Coding Format



FileLinesViolationComment
MyRuler.java9, 86, 87, *ICS-SE0Eclipse-2more than 100 characters in a line
MyRuler.java231EJS p.24Method naming convention

Conclusion
The goal of this assignment was to review another person’s code, based on the Java coding and documentation standards. After examining West and Shum’s code, I see that they followed the standards pretty well. Doing this, they made it uncomplicated to understand what each portion of their code was performing. Following these standard is very useful and would make open source programming easier for all programmers.

Monday, September 8, 2008

Lessons learned from CodeRuler

Description

Code ruler is a java game project open to all java programmers, for competitive real-time competition. It is based on a medieval theme having knights, peasants and a castle. The objective of the game is to occupy as much land as possible, capture your opponent’s knights or peasants, and castle. You can win by eliminating your enemy or by having a higher score. The programmer must write code to control the knights to capture enemy units and castles. Also to instruct your peasants to obtain an abundant amount of land for resource value, this will be attributed to your score at the end. With resources, the programmer will decide how many knight or peasant the castle will produce. Using a good strategy commanding your units, the programmer can attain victory.

Programmers

Ronn Reeves
Robin Raqueno

Strategy

We took two approaches in our strategy for the code ruler game: eradicate our enemy’s economy and at the same time increase our economy.

First we had our knights capture the enemy’s castle, that way we disrupt their production flow. If the enemy were to acquire another castle, our knights would be directed to that castle and ordered to capture it as well. Then, with no more castles to capture, our knights would turn their attention towards the enemy’s peasants. The knights would then be directed to capture whatever peasants that are left at that point of the game. Lastly the knights will capture the remaining knights.

The next idea we had was for the peasant’s movement to cover as much land as possible, so that we rapidly increase our resources for more production of knights or peasants. We had them move in box pattern. Once a border of the map was hit by any peasant, all of the peasants would proceed in uniformed different direction. Also we had the peasants avoid be captured by an enemy knight, by checking two spaces ahead. If that space was occupied by an enemy knight, then the peasant would go in an opposite direction from that enemy knight.

Results



TestOur TeamMigrate Ruler
16946
267614
36522
Gang Up Ruler
1516232
2586133
3525233
Split Up Ruler
1439359
2479354
3529234

Download


Click here to download our version of myRuler.java and the javadoc files

Conclusion
Using eclipse is still very new to me, but I can see that it has a lot of pros than cons. Such as, changing a variable used throughout the file. The user just has to refactor the name at the top, where it is initialized. This is a java IDE that is very useful and I can see myself using for future projects.

Working with a fellow programmer was a very good experience. My project partner, Ron, was open to many suggestions and ideas on how to build our strategy. The only problems with working with another person is having conflicted schedules, but we discussed the project as much as possible through Skype or meeting in person.

Overall this entire project has been very educational. Seeing how well we can work with others in the same field, using a new tool, and working on an open source program. The difficulties of programmers working on the same project and not being in the same room; communication between programmers is must to succeed in finishing a project. Also working with an open source project, commenting code must be at a good level. The process of working on this project has been fun and enlightening.

Monday, September 1, 2008

Open Source Software

Open Source Software: Home Sweet 3D
Description: Sweet Home 3D is an interior design Java application for quickly choosing and placing furniture on a house 2D plan drawn by the end-user, with a final 3D preview.

URL: http://sourceforge.net/projects/sweethome3d/#item3rd-1

Primary Directive 1: Sweet Home 3D is available for the Windows, Linux, and OS X operating systems. Once installed the program’s user-interface is very easy to use, having a list of items on the side panel to just drop into the work space for designing a room. The program also includes a help menu, which helps the user for more complicated projects, such as designing a household. The best part of the program is the 3D panel, which shows the user a first-hand image of how the design would appear in real life. This program is a very useful tool to any home owner or to any person wanting to decorate a room.

Primary Directive 2: The program is packaged into a setup.exe file, which automatically sets up everything for the user. It requires JRE 1.6, but is already included in the package, having no need for a separate download. The program itself did not come with any installation instruction. The only file that was required to be downloaded was a setup.exe file, which makes it very easy for a user to install.

Primary Directive 3: Home Sweet 3D’s source package is a separate download from the setup.exe file. Within the source package are the files to modify if wanting to make improvements or to fix errors in the program. From a software-developers view, the descriptions contained in the files are very helpful in determining its functionality. The coding is very clean and the comments made are very clean. The files packaged are also very organized. The folders and files are named precisely to what its function to the program is, making it straightforward to what file to modify.