Thursday, August 26, 2010

02. OSS Experience

Downloaded the following packages via SourceForge:
  • Sweet Home 3D - most popular Java program on SourceForge. Very elaborate interior decorating application that allows you to create a house from scratch. One of the first features one comes across is the ability to place a window on a solid wall, which allows one to see thru the window into the interior room.
  • Risk - the popular board game coded in Java. Impressive. One can even play in network mode.
  • sQuirrel SQL Client - a java database connect program. This was the only program that was downloaded as a .jar on my Windows 7 machine. Installation produced an error. Maybe if I was being paid to make it work I would've spent more time on it, but I'm not, so I moved on to the next application.
  • The Art of Illusion - a fully-featured 3D Java program. I installed this on my mac and immediately thought, "wow this looks a lot like a monochrome scratchy version of maya."
I decided to review Risk. It was a toss up between that and Sweet Home 3D, but I figured 1) why do the most popular one and 2) Risk seemed like the more masculine choice. And Risk seemed to have better source documentation. And I like board games.

Here's my evaluation based on the three primitive directives:
  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

PRIMITIVE DIRECTIVE 1:
  • Smooth and intuitive gameplay that allows a plethora of options. Amazingly, it even offers network play, which I did not have an opportunity to test. I think the best compliment here is that one hardly notices the GUI at all. Very well done and no noticeable bugs to slow down or frustrate the user.
  • Some nice options, like computer AI-levels, as well as different maps to play on. E.g., Ancient Rome, Axis and Allies, Risk 2210, etc.
PRIMITIVE DIRECTIVE 2:
  • Downloading/Installing - I installed this game on both OSX (Snow Leopard) and Windows 7. The download script was smart enough to download a .jar file for the mac and an .exe file for Windows. Installation on the mac seemed to go a little smoother. On Windows 7, the installation gave me a warning that the application may not have installed properly, but I was able to run it without any problems.

  • Usability/User Manual/Documentation - Excellent. Not the prettiest of user manuals, but basically contains everything the user needs to know about the game, from gameplay, to the intuitive GUI, in addition to guides to the different GUIs (Flash vs. Java Swing GUI). The game itself is very intuitive, and if the user is familiar with Risk at all the manual is practically a luxury.


PRIMITIVE DIRECTIVE 3:
  • Source Files - The installation asks the user if the java source files should be installed. Upon installation, the source files are included in a .zip file and upon extraction, one finds that the code has been nicely modularized into packages, folders, and classes. This was a three-person collaboration (according to the game credits).
  • Importing Files into Eclipse - This caused some hassle. The project did not import nicely into Eclipse and after 2 hours of trying to resolve the 2500+ errors that Eclipse found upon import, I have to assume that the developers used another IDE - or I may be missing a crucial setting in the import. All of the errors seem to be from the naming scheme used by Eclipse upon importing the 136 files that the application is composed of. None of the import statements and package statements seem to have imported properly, thus causing type definition errors.
  • Conclusion: Overall, however, the organization of the code seems very well organized. The game engine has it's own package, as does the computer AI, and the main method is easy to locate (it's found in the GUI interface files). All class names also make sense, and it's intuitive what most of the classes do (E.g., Card.java, Continent.java, Mission.java, Statistic.java, etc.). The code seems to be easy to modify or change due to its modularity and organization.

04. FizzBuzz Program

I haven't programmed in Java in about a year and a half, so when asked to write the FizzBuzz program, the hardest part was remembering all the java syntax.

All in all, though it was a fun project. After seeing how it 'should' be programmed in class as opposed to my 'oh-crap-i-have-a-minute-left' programming style during the quickie quiz, I have a better sense of how to modularize my code.

I also had to look online for a refresher on javadoc conventions.

Time to program and comment: 31 min, 17.5 sec.

Date: August 26, 2010

Some notes on the site below used to prettify things:

Use:
  • Forums
  • Case: Leave Alone
  • C#
package fizzbuzz;

/**
* Fizz Buzz program for ICS 413
*
* This program runs a loop from 1 to 100. If the number is divisible
* by three then it prints "Fizz". If divisible by five it prints
* "Buzz". If divisible by both three and five, "FizzBuzz". Otherwise,
* it will print the number. Each output is on a new line.
*
* @class ICS 413
* @author Kevin Leong
* @date August 26, 2010
*/
public class FizzBuzz {

/*
* Empty constructor method
* @param none
*/
public FizzBuzz(){
super
();
}


/*
* Main Method
*
* @param args[] - command line arguments
* @return void
*/
public static void main (String args[]){


//Create FizzBuzz object to allow us to call non-static
//methods within the class
FizzBuzz fb = new FizzBuzz();

//for loop to print the output of the FizzBuzz program
for (int i = 1; i <= 100; i ++){
System.out.println
(fb.intToFizzBuzz(i));
}

}

/*
* Integer to FizzBuzz Method
*
* This method takes an integer output and returns the appropriate string
* based on the criteria below:
*
* - divisible by 3, return "Fizz"
* - divisible by 5, return "Buzz"
* - divisible by 3 and 5, return "FizzBuzz"
* - else, return the integer as a string
*
* @param int i: takes integer input from for loop in main
* @return String: returns string value to be printed
*/
private String intToFizzBuzz(int i){
//variable to be returned
String returnString = "";

//Test integer to see if it meets criteria
//Note: number is divisible by 3 and 5 iff it is divisible by 15
if (i % 15 == 0)
returnString = "FizzBuzz";
else if(i % 3 == 0)
returnString = "Fizz";
else if(i % 5 == 0)
returnString = "Buzz";
else
returnString = String.valueOf(i);
return returnString;
}
}