Friday, August 31, 2007

07.CodeRulerReview


Michal Zielinski & Chiao-Fen Zielinski's Code Ruler Review































































FileLinesViolationComments
MyRuler.java45, 46, 48, *ICS-SE-Eclipse-22 space indent
MyRuler.java53spelling error"based" instead of "baced"
MyRuler.java48, 49, 50, *EJS-25Capital letter for 2nd, 3rd, 4th…word of variable
MyRuler.java155EJS-22Capital letter for 2nd, 3rd, 4th…word of method
MyRuler.java140, 165EJS-5Indent nested code
MyRuler.java137, 138, 159, *EJS-9Use meaningful variable names
MyRuler.java136EJS-28First for loop should start with "i"
MyRuler.java30, 153EJS-42Descriptions given for only some parameters
MyRuler.java156, 162, 171EJS-76Use { }




Your code is not overly complex in terms of the amount of loops and thus, should execute relatively quickly. With that in mind, you could implement a more sophisticated algorithm for your peasants to acquire land and still be under the 0.5 second limit per turn. Maybe have each of them look around for the closest land controlled by another ruler or that is unclaimed. That way they all won't be traveling in one group as well.

Wednesday, August 29, 2007

Code Ruler Results

I constructed this code alone. I attempted to implement a ruler that would divide his knights into groups and attack the enemy in groups. My peasants would wonder around and claim the nearest land that did not belong to me. This was my basic approach to implementing a ruler. Below is a link to my implementation:

CodeRuler Implementation


Test Results:


My Ruler vs. Migrate Ruler
1: 934 - 0 W
2: 958 - 0 W
3: 936 - 0 W
My Ruler vs. Gang Up Ruler
1: 812 - 98 W
2: 641 - 526 W
3: 36 - 600 L
My Ruler vs. Split Up Ruler
1: 157 - 635 L
2: 356 - 485 L
3: 86 - 627 L

My strategy worked well against rulers that did not have an overly sophisticated strategy. Gang Up Ruler and Migrate Ruler are relatively simpler rulers. Gang Up Ruler groups his knights into one large group and travels around the grid. Migrate Ruler simply groups his peasants and knights and moves around the grid. These two rulers do not have a terribly sophisticated implementation and thus, I was able to defeat them (5-1 against them). Split Up Ruler, however, has a more sophisticated implementation in terms of capturing opponents. When my knights and his knights went into head-to-head combat, Split Up Ruler's knights always won. Since he always defeated my knights, I was defeated relatively easily (0-3).

The lessons that I learned from this assignment were getting more familiar with Eclipse, JavaDoc, and the new Java 5 features. I still need to figure out how to fully utilize JavaDoc, as I was unable to generate comments for my fields in my HTML file.

Monday, August 27, 2007

02.OSS.Experience

Overview:

OSS: MediaSort
Link: http://sourceforge.net/projects/mediasort

SourceFourge description:

"MediaSort is a tool to automatically rename your media files (pictures, mp3, ...) with their metadata attributes. You can sort your pictures by date, camera ... or other EXIF attributes. MP3s by author, album .. or other ID3 tags. Java GUI based on Ant."


Prime Directive 1:

MediaSort allows the user to rename files based on the metadata--commonly called tags--that are stored within various digital files. MediaSort focuses on FS, MP3, and OGG metadata attributes. This tool is incredibly useful to people who have large libraries of files where the metadata is accurate, but the files lack a naming convention. This tool will allow the user to quickly organize his or her file library. Because the tool provides a useful functionality, Prime Directive 1 is satisfied.


Prime Directive 2:

The installation of MediaSort was very simple. Simply download the bin zip folder, unzip the folder, and click on the command script titled "run." Once the GUI opens up, simply point the applet to the source and target directories, select the metadata attributes you wish to include and the order in which you want them to appear in the file name, and click "Copy" or "Move." It is a very easy applet to install and use and thus, I would have to conclude that Prime Directive 2 was satisfied.


Prime Directive 3:

The code for MediaSort is not overly difficult to understand or interpret, however, there is very little documentation and commenting of the code. Although the code is not extremely difficult to understand, documentation and commenting are a must for open source projects to ensure as much as possible, that any external developer can come in and enhance the system. Due to the lack of documentation and commenting within the code itself, MediaSort does not satisfy Prime Directive 3.

Tuesday, August 21, 2007

04.FizzBuzz

public class FizzBuzz {
/**

* @param args
*/
public static void main(String[] args) {
for (int i = 1; i < 101; i++) {
if (((i%3)==0) && ((i%5)==0)) {
System.out.println("FizzBuzz");
}
else if ((i%3)==0) {
System.out.println("Fizz");
}
else if ((i%5)==0) {
System.out.println("Buzz");
}
else {
System.out.println(i);
}
}
}
}


The total time it took to create this program in Eclipse was 5 minutes 20 seconds. Much of the time was spent using the Eclipse tutorial to figure out how to run a java application in Eclipse. After using the tutorial to write the infamous Hello World program, writing the FizzBuzz program was relatively easy. Other than figuring out how to use Eclipse, I did not encounter any other problems with Eclipse or java.

In general, this assignment has shown me how difficult it can be to implement even relatively simple programs that are syntactically and stylistically correct without a computer. The moral of the story is that while technology may be a great asset, we shouldn't rely on it to the point that we cannot function without it. In a world, where many of us use the compiler as a crutch, it is actually hard work, dedication, and practice--and being able to implement simple programs by hand--that separates a decent programmer from a great one.