Monday, September 14, 2009

Coding Standards For You and For Me

Coding standards are something that all students learn when they first start taking programming courses. At first, when everyone is worried about just figuring out how to make their program work, comments and the like are the last thing on a student's mind. As I have progressed through the ICS courses I have taken, the benefits of coding standards become more and more clear.

The biggest reason that I see for coding standards is for anyone to be able to understand how the code works. While it is beneficial for other to be able to read your code, the advantages extend to the author of the code themself! I have come back to code that I have written months before and took a long time to figure out what I was trying to do. It is never a bad thing for your code to be clear and easy to understand.

Also, the ability for anyone in the coding community to learn and collaborate is extremely powerful. Programmers on a team can quickly understand each others code and when it is put all together, everything that someone was interested in would all be consolidated and is all of the same form. Without coding standards, open source software couldn't exist.

I applied the coding standards that we learned in class to the robocode robots that I have previously written. Some of them didn't work and I had a bunch of trouble figuring them out. Looking at the examples of Kendyll Doi and Kimberly Heu, I was able to get my robots working and improved on my previous implementations. At first, I didn't have any comments and probably broke a majority of the rules. Now that I have applied the standards, it is evident that my code is much cleaner and is much easier for someone else to read.

The coding standards that were applied to my robocode project are below:
Elements of Java Style
ICS Coding Standards
ICS Robocode Standards

Download my robocode project here

No comments: