Thursday, September 29, 2011

Becoming Familiar with Build Systems: Apache Ant

This week, I began my first foray into using build systems with Apache Ant, and I must say it was a bit confusing and frustrating at times. The task seemed simple enough at the outset: create a few build scripts to compile and run a sort of "Hello World" java program, as well as a few other things.

I would guess that no more than two minutes passed before I encountered my first error. But this being my first ever experience with Apache Ant or build systems in general, it was to be expected. At one point I remember thinking to myself, "I thought this was supposed to make life easier?" as yet another "BUILD FAILED" message stared smugly back at me. But if theres one thing I've learned from my experiences with trying new things related to programming, it's that there is always a learning curve, and that you have to struggle through it the first few times in order to get better.

All joking aside, eventually I was able to complete the assignment after some headaches. However, I think these katas (practice exercises) taught me a few valuable things. The first, and most obvious thing I learned was the syntax required for Apache Ant. Personally I feel its more important to get a general feel for how things work rather than memorize the specific syntax. I think I was able to do that as well through these katas.

Another thing I learned was that working with filepaths can be a little confusing at times, because there are two filepath types: relative and absolute. I learned that its pretty easy to type the wrong file path and have to deal with some cryptic errors because of it.

Overall, these katas helped me visualize how large scale projects need build systems to satisfy Prime Directive #2, which checks that a system can be installed by users or other programmers. I think this will come in handy later on when I start writing some bigger programs.

Monday, September 19, 2011

Getting Familiar with Robocode

If you haven't already heard of Robocode, it's an open-source game where the goal is to develop a robot battle tank to battle against other tanks written in Java or .NET. The battles happen in real-time and are generally fast-paced and pretty fun to watch.

The game is meant to be educational and fun, and it is--but that doesn't mean things don't get more advanced. Those who participate in Robocode tournaments often use advanced algorithms and techniques such as tracking their opponents moves. Yet at the same time, a beginning programmer can create a simple robot in a few minutes.

To get our Software Engineering class started with Robocode, Professor Johnson had us create a few basic Robots as sort of training methods or "katas" that would allow us to become familiar with the basic movements or actions that a robot can do. While I got a late start and only finished 8 of the basic 13 robots, I still think I might be able to get it together in time for our class Robocode tournament next week.

The robots I did not implement are Position05, Position06, Boom03, Boom04 and Follow03. I found that they were a bit harder than the other robots and because I got a late start I just didn't finish them. I still think I learned something about the robot behaviors such as how to move, locate other robots, and follow or shoot at them. However, I also thought some things were a bit hard to understand. I was surprised at how the gun, radar, and tank interacted. Also, the concept of "turns" during a battle is still a little confusing to me.

I think in creating a competitive robot I will definitely have to first attempt the rest of the basic robots. I think they would be a good foundation upon which to build more advanced robots. This is the first time I've ever heard of the term "kata", however I definitely think they are useful in software engineering. The way they require you to perfect a basic technique as a means to apply it to more advanced techniques is really helpful and directly applies to programming in a lot of ways.

With that in mind, I think my competitive robot design will be based on constant movement and trying to shoot where I think the other robot will be. Whether or not I have the ability to implement those designs is another story...