Monday, September 14, 2009

Robocode coding Standards

The simple Robocode design is now complete, and we are now ready for the next step. It is always a good practice to write your code clean and follow some form of standard, so that other people can clearly read your code and understand. It helps if you follow some form of standard, and this precisely is our next task.

I must say that I ran across a numerous trouble trying to get my Robocode to meet the class's coding standards. I decided that I should start with something rather simple, and that is, to change my robocode project name "robocode" to a more appropriate "robocode-danielhcolton". This; however, did not go as smoothly as I initially thought it would.

I was faced with an infamous nullPointerException after refractoring the "robocode" project name to the new "robocode-danielhcolton". Mysteriously, resetting all of VM arguments, classpath, and the development options under the robocode GUI did nothing to solve the issue. I was very close to giving up but turning the assignment in with an inappropriate project name was not an option for me. I finally solved the issue by creating a brand new project under the new name "robocode-danielhcolton" and copying all the necessary .java files to it. Although I was happy I finally got it to work, I sure wish this simple renaming process were a lot more simple.

The rest of the process was rather easy in comparison. The xml document that our professor provided sure did a lot of help in terms of making our code much more readable.

Following a coding standard while programming is very much like writing essays with correct grammar. A reader will have a much difficult time deciphering your writings if your essay is full of spelling and grammar errors. Coding standards must always be followed, especially if you work with a team of programmers.

Here is my revised version of Robocode Project


No comments:

Post a Comment