Monday, August 31, 2009

OSS experience

The Java Project I chose: Dependometer

After browsing through some of the Java open source projects, I chose to take a look at Dependometer for it seemed like an interesting tool that could very well help me write a more efficient and clear code in the future.

Prime Directive 1:
Dependometer basically is a tool that provides you with the software metrics of your projects/programs. As you might be able to tell from its name, Dependometer measures software metrics of a program in terms of the dependencies of classes. It then generates an html document that summarizes the metric readings. Knowing the software metrics of your program is important for programmers because it helps them analyze its complexities. Dependometer, therefore, can ultimately be a tool to help reduce the complexity of your program. It also satisfies the first directive.

Prime Directive 2:
I must say that it seemed quite simple to install this program at first, until I figured out that it requires Ant in order for this program to run. Since I am still not an expert at installing programs on commandline, it took me a quite a bit of time and googling before I finally got the Ant installed on my system. The rest seemed a little easier. I placed an xml file inside the project directory and tweaked the file according to my needs. Finally I ran the the Ant command with the xml and Depondometer then spat out an html document with the results. I would say that the tool satisfies the directive only if the user is an expert at installing programs under commandline.

Prime Directive 3:
Dependometer does include extensive documentations so I would say that modifying this program can certainly be done a lot easier than those with no documentations at all. In this respect, I would say that Dependometer satisfies the third Directive. It would not be easy, however. The code does look complex and it would most likely take me long before I can actually start modifying any part of the project.



My FizzBuzz Program

public class FizzBuzz {
public static void main(String[] args) {
for (int i = 1; i <= 100; i++) {
if (i % 15 == 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(i);
}
}
}

It took me about 10 - 15 minutes to write this program on eclipse. When I originally solved this problem on a sheet of paper, I wrote the first if statement as if((i%5==0)&&(i%3==0)), however I realized later that writing it as above is much clearer.

I would have to say that since I am not used to programming on eclipse, it took me much longer to program this FizzBuzz program than usual. But I feel that once I get the hang of all the GUI functionality and additional features that eclipse provides, I will then be able to code much faster.