Wednesday, September 30, 2009

MistaRoboto Domo Arigato

It has been about 3 weeks since we first implemented Robocode. It is now time to build our Robocode project in a more professional manner. During our class exercise, we have done some practice building/compiling projects on an open source build tool called Ant. Ant is a convenient java build tool that provides you with many differnet features. We also use Ant with other useful tools such as Ivy, Checkstyle, FindBug and PMD. Most of these tools provide means of error and style checking, which is extremely useful when it comes to building and writing a readable code.

Building together my version 1.1 Robocode project was not an easy task. I faced numerous problems trying to get the Junit and PMD to work and succesfully run on my project. The problem associated with Junit turned out to be that the compile command in build.xml file did not place my robot.class file properly into the lib/robocode directory. I was unable to figure out the source of this problem; however, re-downloading and re-installing the package seem to have fixed the issue.

The PMD issue was a tricky one. It turns out that the problem had nothing to do with editing of .xml files or misplacing of files. The issue was within the .java source code. I began to test my source code by commenting out one block at a time to see which line was causing the issue. I pinpointed the problem down to the block of codes involving the override of onHitRobot method. It seems that this block of code was preventing the PMD check to fail for an unknown reason. I have solved the issue by removing the lines of code.

I have learned a lot through this exercise. The use of CheckStyle was what stunned me the most. CheckStyle able to spit out about 50+ style errors in my source code initially. Through looking at the output html file, I was able to improve my code and make it much more readable. I find these build tools to be extremely helpful, and I hope to improvise these tools in the future when I develop more and more complex systems.

My Robocode MistaRoboto is available here

No comments:

Post a Comment