Wednesday, August 31, 2011

Chapter 2: The Infamous FizzBuzz

The FizzBuzz program is a problem that is used by interviewers in software development to determine whether an applicant can actually program. The reason it exists and is used in interviews is due to a belief that is held by many software engineering professionals: most so-called programmers can't write code at all.

So, as a software engineering student I guess it's a rite of passage that I provide my version of the FizzBuzz:

In the first implementation, I was simply trying to complete the requirements and see that the output was correct. After I started up Eclipse and created the project files, it took me approximately two minutes and thirty seconds to complete the program and verify the output. Because we had completed the problem in class a few days before, the completed code did not take very long at all.

In the second implementation I altered the code to make it more modular and organized. This practice lends itself to creating bigger projects with more lines of code. From start to finish this implementation took a little longer at about four minutes, but I think it is a more useful implementation than the first.

This exercise, though short, made me think about software engineering and how time is spent coding. Good code that scales well will save time in the long run though takes more time initially to write. However, bad code that is quicker to write initially could cost you a lot more time later on.

My hope for the future is that I will make it a habit to strive to write better code that is easier to read and understand, rather than simply find the quickest solution. Though I think I am still learning the basics of programming, I think this approach will pay off in the long run.

Sunday, August 28, 2011

Three Prime Directives: iPod xTract

The Three Prime Directives for open-source software engineering are goals for developers to ensure that their system is useful, easy to install, and easy (for other developers) to understand. Furthermore, only an external user can verify that a system meets the Three Prime Directives. In my quest to learn more about how to achieve these goals I decided to look at an open-source program called iPod xTract.

One of the main gripes I've always had with the iPod over the years is the lack of an easy way to extract songs from an iPod to a computer. I have always assumed the reason for this is to prevent the sharing of songs amongst users. However, I've also been unfortunate enough to have lost my entire music library once due to a failed hard drive, so I recognize the need for users to be able to retrieve their songs as well. iPod xTract claims to accomplish this task by allowing users to search their iPod and save the songs they want to a local computer quickly and easily.

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

In short, iPod xTract does exactly what it claims to do. I was able to access my iPod, search for a song, and save it to my computer quickly and easily. It's a simple program that does its job well. The developer mentions that he began the project because he was unsatisfied with similar programs that were slow due to the indexing and displaying of the song library in its entirety. iPod xTract is much quicker because it does not retrieve anything until the user hits the search button. Overall, it accomplishes its task successfully.

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

I downloaded iPod xTract as a .jar file which I was able to run on Mac OS X, and I believe most external users should be able to download and install the system fairly easily. Once the program started, I was able to select my iPod and quickly search for a song to extract.


The user interface was simple and easy to use. Searching was made easier with parameters such as title, artist, album, year and genre. From there, it was as easy as hitting the 'Extract Song' button to save the song to my local computer.


Songs were downloaded almost instantly to their specified directory and I was able to play them in iTunes and Winamp. I found iPod xTract to be so useful and painless that I will likely use it again in the future and recommend it to others as a useful tool.

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

The source code for iPod xTract was formatted in a way which was easy to read, and there was a decent amount of comments to aid other developers in understanding the code. There were also javadoc comments throughout the code, so other developers could get an overview of the different methods, classes, and other components which make up the program. One thing I did not see was a basic overview, or explanation of how the system works for prospective developers looking to enhance the program. While the current level of documentation might be acceptable, it would help other developers to have this overview available. Had this been provided I believe iPod xTract would have completely satisfied prime directive #3. I think if I had time to become familiar with the code I would be able to at least modify the system or attempt to improve it.