Monday, August 31, 2009

Falling Off the Java Bicycle: FizzBuzz Implementation

After a two year break from java, I once again returned on the popular java programing language, and this time I feel off the bike pretty hard. The object of the program is insanely simple after programing for a few years. I understood exactly what I had to do and what I needed to do to get there the second the program was described. Then why did I fall? The primary reason was the my decaying memory of the java language syntax. Writing java down on a pice of paper after two years was insanely hard. With only fragments of the opening syntax, many a times I would look down and realize my line prints in C. Quite embarrassing to come into a high level class like this I feel like a total beginner again.

After the failure in class, the assignment was the do the code once more. This time I remembered the correct syntax and was allowed to use the Eclipse editor, needless to say, I was able to blaze through with all the speed of a top notch muscle car. From the time the editor loaded to the completion of the comments and test run, it took all but two or three minutes. Half the speed comes from the Eclipse editor as it has many useful features such as autofilling of functions and easy copy paste features. Eclipse also allows you to shave from a few seconds off your time to a few minutes depending on the program with its pre-filled public static method, and the amazing ability to compile and give error messages while you code. Overall even with such a simple program, even programmer can fall into these simple traps, and the course design gives an overall feeling of a well designed prep course.

Below is my second attempt at the FizzBuzz program:

OSS Experiences: DRAW ME!

Today, I will be evaluating the vector graphic drawing application GlyphEdit. The program is written in java and runs on popular platforms including, Windows, Mac, and Linux. The basic features of this program allows the user to create simple vector objects using predefined shapes and lines. A few extra features allow you to group, rotate, scale, and even add text to the object.

The first question that comes to mind is, what reason is there to use GlyphEdit when there are already many open source graphic tools that do a lot more, e.g., GIMP. The one feature that stands out in GlyphEdit is the ability to save the graphic in the 3D geometry data format, OBJ. Which for the purpose of this blog, i.e., focuses on java, allows us to easily implement graphics in java applets without the constant guess work.

Sounds useful! But I downloaded another application and couldn’t figure out how to run it! No need to fret here, after unzipping the file, all that is needed to run the application was a click on a file corresponding file for your OS. The application’s GUI elements were made to mimic the simple clean look of a Mac OSX application. The button layout, standard to most graphic editing program, you choose a shape on the panel to the left and click on the canvas to draw.

The last useful thing about GlyphEdit is that it is written entirely in java. Browsing through the folders you will be able to find all the java files, then open and view them. The files are separated into the graphic objects and the applications GUI, all with full comments; allowing you to easily change the layout of the buttons or add new features such as color selection.

Overall, while overly simple, I found the application very practical and useful as someone who has tackled a java applet or two. Although there are some hiccups here and there with newer OS versions, it is definitely a keeper in my java archives.