Monthly Archives: February 2012

Importance of Reusable Code

I’ve been told over and over again about importance of writing modular code, that is, code that can be easily extended and reused. Yet, even with this in mind I still sometimes find my self hard-coding things only to wish I hadn’t later down the road.

For instance, today when I was scrolling through the spread sheet that I log all of my hours in for Gridnet, I realized that it’s been almost seven months since I first started work on it.  While that is quite a long time, I’ve only logged about a hundred real hours into the project. Regardless, I was curious where all of my time had gone. Luckily, when I started the spread sheet I had decided to keep a column that notes the general things I did on any given day. I found that I had spent most of my time rewriting previous code because I needed to add a new feature that wouldn’t work with the current system. This appeared several times throughout the spread sheet, which is quite saddening.

Obviously,  rewriting code wasn’t an ideal way to spend my time; it causes me to lose focus on current goals, break other parts of the game causing bugs, and promoting general unhappiness with the project. I’ve found that the best way to combat this is to always write modular code. Even if I don’t think I’ll need to extend it later, it’s better to invest a few minutes now that waste many hours later.

However, there are occasions where I need to rewrite code. For instance, the purpose of doing an optimization pass on a project is to rewrite inefficient code and replace it with something faster. For the most part though, it doesn’t require too many touch ups unless of course I’ve made some really poor design decisions in the beginning.

I Own a Blog, I Should Use It

I’m going to attempt to write more often to actually make use of this website. Not just by adding more development posts but actually writing about things going on in the industry, other games worth mentioning, etc. The biggest thing keeping me from writing was mostly because of all the school work I’ve been dealing with, however this semester is fairly light so I will have more time to not only write but also work on games! I will have a post up soon regarding the status of Gridnet, which happens to have some exciting news.

On another note, I realized after the first week that my weekend jam idea turned out to be a little too much work for my schedule. Aside from Gridnet, I have a handful of other small projects I’m currently working on such as: stat system and path finding libraries/extensions for FlashPunk, my Minecraft plugins, a small Pacman-inspired game (which is just about complete), and another secret project. So I have plenty of things in the pipeline for the near future!