Skip to content

Development Blog

by stefanhendriks on October 17th, 2010

Refactoring is always fun. It allows you to make things better in a lot of ways.

Basically refactoring means you change the code, but you do not change functionality. There are multiple reasons to refactor, ie: it allows you to make the product (game) easier to maintain, have less bugs, and also important.. make it easier to extend.

Refactoring should be done in short cycles. Refactoring big chunks of code is often painful (slow) and results in more bugs. For D2TM I refactor relatively bigger chunks. Well, to be honest I had to create chunks in the first place. There is/was so much tight coupling in the code, that even in small changes I would break many things.

So the first steps are/where to decouple the code. This results in a lot more classes. But, the class files all have their own unique responsibility. This is a good thing!

However, as with any refactor cycle, things are still bound to break. Today I am working on fixing the ‘place it’ code. Which basically means; whenever you click on a structure icon that has finished building (so you can place it), it has to work properly. For now, it works for the drawing part. But, the green/yellow/red colors (meaning, does it have pavement, or rock, or is it unplacable) of the ‘status of placement’  drawing goes wrong. Atleast, somewhere down those lines. It is mostly in those areas where ‘new code’ meets ‘old code’ that bugs occur. And this is exactly such an area.

When this issue is fixed, there is still a lot to do. Using Pivotal Tracker several functionalities/scenarios are written down that need to be done. It does not mean it will be done all before one big release. But it does indicate where this game is going.

If you have any suggestions for this project, please share. You can provide them by commenting to this post, or by using the several ways to deliver feedback.

From → Development

Comments are closed.