Sunday, September 13, 2009

Coding Standards

Coding standards are a set of guidelines that programmers follow in order to make their code easier to read and understand. These standards involve things such as formatting, naming conventions, and documentation. Code is easier to read and understand when it is in a format that is familiar. Coding standards are also useful because the majority of code that is created will be read and modified by many different people.

Reading and understanding code that is written by someone else can be a difficult task. Writing code conforming to standards helps make it easier. The use of meaningful comments that explain difficult or essential parts of a program can speed up understanding a lot. On the other hand, having poor comments and bad formatting can make understanding nearly impossible for large, complex programs. Making code as easy to read and understand as possible should be done as a courtesy for the next person who has to work on it.

There were three coding standards that were implemented for the Robocode project. Each of the standards provide useful guidelines that make code easier to read and understand. These standards are listed below.

1) Elements of Java Style
2) ICS Coding Standards
3) ICS Robocode Standards

Upon review, I found that my code was not conforming to some of the standards for this class regarding formatting and documentation. One violation I found was that I was using tabs for indentation rather than two spaces. At first, I thought that it would be very tedious to change the formatting of my code to conform to the standard. I was glad to discover that the formatting of my code was easily fixed with the use of the provided XML file. I also added documentation comments to my code so others who read my code will know the purpose of the code at a glance.

The .jar file containing my code can be found here.

No comments:

Post a Comment