Quality Assurance is not an entirely fun task, so I used PMD, CheckStyle and FindBugs to aid in this process. Here is a quick overview of what these tools can help you accomplish:
PMD scans 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 bug
CheckStyle also scans Java source code and looks for style violations among various others.
FindBugs checks Java bytecode for known bugs. This static analysis tool can spot null pointers, problems with equals() and hashcode() implementations and many other issues that may have been overlooked.
While these tools should not replace a person doing line by line code analysis and review, it does help automate catching the low hanging fruit.
Along with creating a fully automated build that has been tested with junit test cases ready for you to download and run instantly, I have also improved FlankBot, my Robocode battle bot, to be more intelligent against Walls based robots. Some of the improvements are:
Conserving Energy (only shooting when close, only shoots if miss is below n)
Detection of Walls Bots ( 95% winning against sample Walls)
Download Flankbot with Robocode here.
0 comments:
Post a Comment