Saturday, January 8, 2011

Back to the bit mines

After a brutal cold that laid me out for a couple weeks, followed by a busy week at work this past week, I've finally gotten ambitious again and gotten some work done on the game. The only thing a user might see is that units slide more smoothly on the minimap; other than that, the game behaves exactly the same as it did before I spent two hours fiddling with it tonight. But the code that makes it happen is a whole lot cleaner and easier to understand, and WORLDS easier to extend for anything I add in the future.

There's a term gaining popularity in the software development world called "technical debt". Technical debt is a way of thinking about the trade-offs that are made while development is happening, and can be used as a tool to help communicate certain technical costs to non-technical people. A very simplified version goes like this: Any time you hack in a quick fix in code, you've added an amount of technical debt equal to the time you saved by doing the quick version instead of a really good solution.

The problem with technical debt is that it accrues interest. Every time you work in code that's burdened with technical debt, your work goes slowly. The more technical debt, the slower the work goes, until eventually things grind to a virtual halt.

Of course, at any given moment, when faced with any given decision, the quick-and-dirty road will ALWAYS get you faster results in the short term. And yet by consistently avoiding technical debt, overall development speed is significantly higher in the long run.

So as much as it might not be super-exciting for other people to look at, a fair bit of my development effort is actually spent just moving code around and rewriting things I don't like the look of. But in the long run, it means that the few hours a week I can currently find to work on this game will be spent working in really clean code being as productive as possible. And with a new baby on the way in a couple months, anything I can do to make sure I can step in and get some development done quickly is going to be a huge help.

I think the next item on the agenda is more code cleanup. I'll be tackling the code I use to render walls and floors and making that code a lot smarter, and as a side-effect it should make it almost trivial to add in the concept of explored versus unexplored terrain, allowing me to hide areas of the map that haven't been explored yet. So there might actually be a visual update there, which would be exciting.

No comments:

Post a Comment