Wednesday, September 30, 2009

This Picnic is Ruining Our Ants! The wonders of Automated Quality Assurance.

There are times in everyone’s lives where they think to themselves, “Oh my goodness, do I really have to do this so specifically?” Whether it’s sorting coins to deposit in the bank, or looking over the grammar of a paper, the time consuming simple tasks are the kinds that can drive you the most insane. But that doesn’t mean they aren’t important, without something sorting coins or checking our grammar, we wouldn’t have organized coins and our papers (and blog entries) would be in shambles. And so we partly rely on automated mechanisms to help out. For coin sorting people can use CoinStar, for grammar one can rely on the magic of Microsoft Word’s spelling and grammar check, and for programming Java and our Robocode robots we have Ant.

In actuality the Ant build system isn’t really the only thing we use. Ant is a tool to help construct products (or as we call it, build) so that other people can easily work with from our java. It uses another program, Ivy dependency manager, to manage the acquiring of resources and things necessary for Ant to run smoothly. With Ant and Ivy together we can put together builds into single zips and check it with our programming equivalent to spelling and grammar check: CheckStyle, PMD, and FindBugs.

As part of our learning about Quality Assurance we were introduced to CheckStyle, PMD, and FindBugs as a way to make following the formatting and covering problems we might create easily and automatically without having to read line for line ourselves. It’s not surprising that in order to reach a nice level of quality we’d have to rely on more than one source; each item finds different content and has a different focus.

Checkstyle is our format checker, it would be the closest equivalent to Grammar checking. It looks at the code as we typed it (also called the source code) for errors in spacing, writing standards, and page setup that we can custom set in the xml file for this and gives it different rules to follow. PMD looks for a combination of formatting errors and possible errors we‘ve made in code that might cause the things we program to not work well or at least not optimally. Lastly, FindBugs looks at how the code we write is suppose to work (in what we call byte code, or the computers language) and looks for errors that may occur. Sometimes they overlap and sometimes not, but it’s better having 3 things check it for problems then for the problems to rear their ugly head later.

No major issues when I took the code for GunAryos from our previous entry and reworked it into Ants. There was some trouble when I updated the code because of my formatting but quickly going through that it was all clear. It was 1 code that needed fixing because it could be simplified (making it 1 Checkstyle, 1 PMD, no FindBugs errors). The problem occurred mainly because I had written code that could have been simplified into shorter statements, one involved comparing a boolean value with the value true which is unnecessary and the other involved using two if statements I could combine into one. In the end they were easy to fix and build into its knew release form.

GunAryos in its new wrapping and with slight modifications can be found here.

Ant wasn’t the easiest thing to work with but because we were provided with a sample system by our Professor, the trouble with it was less about the programming itself and more about understanding what each line of code did for us. I found it fascinating that we were learning new code (Ant based code) in order to make it easier for us to write/finalize old code (Java). I think that using it will make future projects that much smoother and keep us both comfortable with the formatting of the language and help us stick to coding standards as well.

EDIT (10/5): GunAryos has been given two JUnit tests vs. Crazy and Walls you can download this distribution here. This will be helpful for peer JUnit reviewing that may occur until the next unit is complete.

No comments:

Post a Comment