Tuesday, August 30, 2011

FizzBuzz, A Return To Java

The last time I've really coded in Java without learning a concurrent language was ICS 111. Since then I've renounced Java, as alternate dynamic languages I've learned in such classes as 215 and 313 was a lot more appealing to me. Diving back into Java on the first day of 314 was a challenge (though, it was akin to riding a bike, you never really forget it).

Asking to go back to Eclipse was another blast from the past after switching over to Emacs in the past year. The first problem being that in Emacs I use viper-mode, a plugin that emulates the keybindings for vi. To get writing the code, I had to dig into the settings to switch to emacs keybindings, which was a little more familiar to me. Factoring this into the equation I produced the following code in about 10 minutes:

Sunday, August 28, 2011

JFreeChart vs. JChart2D, a tale of two philosophies in Open Source Software

One of the greatest things about software development in the modern world is the amount of free, open-source software made available for anyone with the know-how and determination to use them.  With the popularization of cloud storage, easy version control systems like svn, cvs and git, and sites like sourceforge and github, one can easily host projects that are easily accessible and maintained.  With the popularization in open software comes a over-saturation in options to choose from.  It's with guidelines like that proposed by Philip Johnson's Three Prime Directives, that one can judge a project usable and truly open.

Here I will use the simple JChart2D in comparison with a much more complex JFreeChart to demonstrate the best ways to successfully produce a truly effective open-source program.

Could this ...

... be better than this?

Prime Directive 1: The system successfully accomplishes a useful task. 

The reason I chose graphing programs was my experience with trying to find a suitable graphing program for my needs in ICS 311. Along with deploying an applet, we were required to graph the ratio of Maximum Flow graphs. We had an option to use Third-party software but due to time constraints I was unable to find one that would suit my means. Both JFreeChart and JChart2D would have suited me fine in plotting out the data calculated, and so would've allowed me to pass the class.

Prime Directive 2: An external user can successfully install and use the system.

Here is where the philosophies of both softwares diverge. From a perspective of a cash-strapped college student, one can only successfully use a system if it's either intuitive to use or there exists free documentation provided to quickly help me achieve my goal. JFreeChart, despite the name, provides insufficient documentation through sourceforge and instead charges $65.00 per client. The system being so popular (4,747 downloads on the week of August 21st), I thought I would be able to use a powerful system that would help my code be presentable and sophisticated. I, however, was left dredging through undocumented source files and demos whose source code I could only purchase.

JChart2D, though being a less polished and unpopular charting system, has an intuitive, understandable usage page explaining the infrastructure involved and providing code samples for plotting and drawing a simple graph. The time it took from downloading the provided jars to building my own graphs was significantly less than it would take for me to understand and use JFreeChart without the documentation. While JFreeChart provides source code and allows for free usage, provided that you can decipher its infrastructure, JChart2D embodies the spirit of truly free open-source software in that it doesn't require its users to pay for its service.

Prime Directive 3: An external developer can successfully understand and enhance the system

Both system's source code is readily available through Sourceforge, JFreeChart provided directly from Sourceforge's Download page, and JFreeChart through CVS. Both systems are well-documented, using the Javadoc system to provide descriptions and guidelines for paramaters and return values for each method. The problem with JFreeChart, however, is that its system is never really clearly described (at least, without purchasing the Developer Guide) such that one can't figure out what to change. JFreeChart's source is fragmented, with one section regarding its charting functions and one section regarding its data management, with no clear explanations of its infrastructure (the provided documentation at the root of the data source, for example, reads "The base package for classes that represent various types of data.", with no instructions how to create a dataset for use with a JFreeChart object.

JChart2D on the other hand, has an advantage of having available documentation. One can easily understand the main components of JChart2D because of the simple pictoral representation of its architecture. Granted, its architecture isn't nearly as complex as JFreeChart, due to less functionality, but complexity could be easily solved by good documentation, something that is not available from JFreeChart by default.

In summary, JChart2D, through a comparison with a more popular, yet less intuitive JFreeChart, embodies the benefits of truly free open-source software. It is easily deployable through Sourceforge, provides straightforward explanations of its usage and architecture and invites people to both use it and modify it for free.

Friday, August 26, 2011

...Aaand we're back.

To say that this week has been rough on the state of my computer would be an understatement.  To start off this semester I've made one giant mistake that is often disastrous in both Computer Science and life itself in that I made a last-minute change.

A week before, I had upgraded my laptop's hard drive to a Solid State Disk Hybrid Drive, the Seagate Momentus XT, which combines a small partition of flash memory and a 7200 rpm hard disk.  To my dismay, I found that my existing Windows 7 installation on my computer would not work with the new hardware, even if I cloned it and restored it with Clonezilla.  With not having a optical disk drive (the trade-off with portability) I had a hard time creating a bootable usb drive with the recovery disk I received with the laptop, only to find out that I needed an install cd with the disk.  This is where I gave up recovering my old configurations and started looking for alternatives.

Having found an official Windows 7 SP1 iso online that I could boot with help of Plop Boot Manager, I made a fresh install on the new hard drive only to find out that the Product Key that came with my laptop (and, after a year being spent on the underside of my laptop, was nearly illegible) did not work with an SP1 install.  One would wonder how good a Product Key is if it doesn't work with the updates that it's good for.  Instead of putting myself through more trouble I decided that since there is software available for installing and making a bootable install on a flash drive via UNetbootin, I'd try for a linux partition in replace of my Windows 7 Install.  Instead of the traditional Ubuntu install, I thought I'd stray from what I was familiar with and install Mint Linux LXDE, a distro based on linux that employs both the lightweight manager LXDE and proprietary software like Java and flash by default.  While I did like the window manager, I was unfamiliar with the distro's navigation.  I could not bring up the file system other than from the menu bar, among other things.  The system did not work well with my NVIDIA ION GPU, as well, always resulting in weird artifacts when, say, I'd launch the terminal.  The system crashed a fair amount of times, often when taxing the GPU by watching videos, so I decided to install another linux distro I'd heard was good: Debian.

As opposed to Ubuntu, which is sponsored by Canonical, Debian is tied directly to the GNU open-source project and doesn't have a centeral supporter, and instead is developed solely through volunteers.  This makes it a great incentive for people to support truly free and pure software.  Unfortunately, Debian did not play well with my experience with Linux and with installing a system.  Whereas Ubuntu has live CD's with an easy install system, Debian employed the old system of a series of menus with options about the installation.  Looking to keep a partition to install Windows 7 later on, I tried my hand at manually configuring the partition (1 Ext3 partition for Debian, 1 Swap partition and 1 NTFS partition for Windows 7).  When the installation finished, the morning of the day Assignment 01 for ICS 314 was due, I found that the LILO bootloader did not boot into the Debian install but was dropped down to a busybox shell provided by LILO.  No amount of Googling and tinkering made the install bootable and so I missed Assignment 01.  As soon as I got home, however, I decided to return to the tried and true Ubuntu install.

As of this blog, I am now running Xubuntu 11.04, an Ubuntu distro that uses the XFCE window manager as opposed to Unity, Ubuntu's new window manager which has received mixed reviews.  It is an upgrade from 10.04, which I had installed alongside my Win7 install on my previous hard drive.  It seems to be just as good as I remembered it, if not better with significant improvements.

I've learned a lot about the perils of last-minute changes enough from my work as an A/V Operator at the East-West Center.  I should have given more time for me to get up to speed with my hardware and software but I was unable to get my configuration on par with my desires in time for Assignment 01.  Instead that leaves me with a wake-up call and an incentive to work extra hard in the future to catch up.