In the world of rumbles and tournaments, in order to win, you must train. As part of training for a Robocode tournaments, one must assure that his or her code is error free. To do this, I called upon the help of specialized trainers.
What each trainers do: (according to their respective websites)
Ant: It is a Java-based build tool
that evaluates a set of dependencies, then execute commands.
Checkstyle: It provides checks that find class design problems, duplicate code, or bug patterns like double checked locking.
PMD: It scans the Java source code and looks for potential problems like:
•Possible bugs - empty try/catch/finally/switch statements
•Dead code - unused local variables, parameters and private methods
•Suboptimal code - wasteful String/StringBuffer usage
•Overcomplicated expressions - unnecessary if statements, for loops that could be while loops
•Duplicate code - copied/pasted code means copied/pasted bugs
FindBugs: It looks for bugs in the Java programs. It can find bugs by simply inspecting a program's code: executing the program is not necessary.
During the training sessions, MikeTerry was able to work on shortening his comments, labeling his parameters properly, and putting in the author tag. With these trainers MikeTerry's muscles (code) became more effective. The encounters between MikeyTerry and his trainers were unexpected. I had expected a few querrels and stubborness on either party but they worked pretty good with eachother. No particular problems. As the main trainer for MikeTerry, I have learned from his other trainers that my standarization coding must improve and how many ways I can improve other programs training. I really like these trainers as they simplify the training and elimate most of the tedious tasks that I have to encounter during a training.
After the training with the other trainers, MikeTerry and I worked on his level of energy for the next tournament. He was already well trained but with the increase of energy, he will be able to last longer in battles.
Here's a look at the before (this is a .jar file) and after (this is a .zip file) of MikeTerry's code.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment