Sunday, August 31, 2008

The Open Source Software Experience

There are three 'prime directives' that developers should strive for when writing open-source applications. To better describe the directives, I will be evaluating a Java-based project called Vuze that I found on sourceforge.net.

Overview
The project that I will be examining is a Java-based bittorrent client formerly known as Azureus and is now known as Vuze. The difference between Azureus and Vuze is that Azureus is strictly a bittorrent program, whereas Vuze combines Azureus' functionality with a Youtube-like portal of digital content such as movies and games that users can download using the bittorrent protocol. The older versions of Azureus are still available for download, but the company has discontinued support for it and are now focusing their efforts on Vuze.

According to their homepage, Vuze's goal is to create a bittorrent community where independent people and companies can share their videos, music, and games with a large audience and, if they choose to do so, charge them on a for-rent or to-own basis. This is an attractive proposition for anybody who has something they wish to share but don't necessarily have the bandwidth to distribute it to the general public. Allowing companies to charge for their content also provides an avenue for digital distribution, which has significant advantages over buying a physical medium at a retail store. Essentially, their goal is to create a one-stop shop for digitally-distributed media, using the bittorrent protocol as a means to alleviate bandwidth issues.

Vuze homepage: http://www.vuze.com/app
Sourceforge page: http://sourceforge.net/projects/azureus/

Prime Directive 1 - The system successfully accomplishes a useful task.
In order to fulfill Prime Directive 1, a program must provide some sort of useful functionality for the user. Vuze definitely fulfills this criteria. It provides a working bittorrent client that can not only download torrents from its own portal but also take any torrents found on the web. The portal also provides tools for content creators so that they can add their files to the network and share it with others. A system is also in place for purchasing content, although this mostly applies to games from what I've seen, as almost all the videos are trailers rather than full-length movies. Also, based on the number of comments and how fast videos download, there seems to be a sizable active community, so Vuze looks like it's definitely progressing towards its goal.

Prime Directive 2 - An external user can successfully install and use the system.
In order to fulfill Prime Directive 2, a user must be able to download, install, and run the program without running into any roadblocks. Vuze satisfies this directive by providing a very clear link to the downloadable executable on their homepage. They also have Linux and OS X versions available in addition to the Windows version. On a Windows machine, an installer automatically installs the program and the process is very straightforward because it uses the standard Windows installer. Vuze itself is easy to use thanks to its well-designed interface. Documentation is provided but is hardly necessary because of how simple the program is to download, install, and use.


Prime Directive 3 - An external developer can successfully understand and enhance the system.
In order to fulfill this prime directive, the source code for the application must not only be available, but it must also be formatted and commented in a way that makes it easy for anyone to edit it and add or change features without having to spend an extraneous amount of time figuring out the existing code. The source code for Vuze was provided on their sourceforge page, and I downloaded it and took a look at it. Unfortunately, the program is split between very many Java source files, but apart from the folders that the files were found in, there is no indication of how it all ties together or even how to compile it. Also, only a small number of files contain any comments at all, and those that did were woefully lacking in details, often only providing simple comments that don't explain things well enough to get a good grasp of what a method or code block is doing. No documentation was provided either apart from a change log. Vuze fails the third prime directive because it would be hard for anyone to understand the source code, let alone make any modifications to it.

The lesson in this exercise is that, to write an open-source program, a developer needs to keep in mind three principles that will help his or her program to thrive. If the program does not serve a purpose, nobody will want to use it. If it is hard to install or work with, nobody will want to use it. And finally, if other developers cannot easily understand or modify the source code, nobody will know how to improve it.

Wednesday, August 27, 2008

FizzBuzz programming exercise

This is the first blog post of many to come, so it may be a little rough around the edges. I'm currently attending a course called ICS 413 - Software Engineering, and this class teaches what I hope to be efficient programming practices that I can apply in real life, a stark contrast to my other courses which I feel are more like intellectual exercises rather than practical examples.

The Exercise
A simple exercise to start us off, this one has us refreshing our Java skills by programming something relatively simple. The output has to be a count from 1 to 100, one number per line, except that if the number is a multiple of 3, the output is "Fizz", when it's a multiple of 5, it's "Buzz", and when it's a multiple of 3 and 5, it's "FizzBuzz". This program, though deceptively simple, was a good measure to see how our Java knowledge has stood the test of time, since for most of us, the last Java programming assignment we've had was in ICS 211 almost two years ago.

The Process
Of course, the foundation of any good programmer is a good IDE, and Eclipse is the IDE we're using for the course. I've used Eclipse before back in the introductory Java courses, and the developers have made some huge improvements to both the speed and the interface of the program. Unfortunately, they also made it display a welcome screen that blocks the windows behind it, and it's not immediately obvious that you have to close this window to see anything behind it. When I tried to create a new project and a new class, I thought something was wrong when the welcome screen didn't change until I realized that I had to close it first. Not exactly very intuitive if you ask me, and a slight issue where HCI is concerned.

Fortunately, the actual programming itself went quite smoothly except for one problem where I forgot how to declare a method with no return value. At first I was trying to use public static null FizzBuzz(), which didn't work. A quick Google search reminded me that it's supposed to be void, not null. For the past few years, I've been programming mostly in Visual Basic for an Access database so I'm a little rusty at Java, but I have to say, forgetting something as simple as this is pretty shameful for me. The entire program from beginning to end took 8 minutes and 2 seconds to write and it served as a nice reminder that I need to brush up on my Java syntax, something I'm sure I'll be getting a lot of practice with from this course.

Code
public class ClassFizzBuzz {
public static void FizzBuzz() {
for(int i = 1; i <= 100; i++)
{
if((i % 5 == 0) && (i % 3 == 0)) {
System.out.println("FizzBuzz");
}
else if (i % 5 == 0) {
System.out.println("Buzz");
}
else if (i % 3 == 0) {
System.out.println("Fizz");
}
else
{
System.out.println(String.valueOf(i));
}
}
}

public static void main(String[] args) {
FizzBuzz();
}
}