Much Tinkering

Published December 17, 2006
Advertisement
As mentioned previously, I need to expand some of my preprocessing tools so I can support distortion-style texture processing. The tools (and, in fact, a good portion of my library code) come from an obscure library on sourcefourge - basically one person's common code which they stored there. Theres about 20% which is really useful, about 10% which is interesting but not how I like to do things, and the rest I just tend to ignore.

A few months ago I finally decided to fork off, because the useful bits were really good, but the rest was dragging it down and stagnating. While I could change code before the fork, I always kept the changes simple and small because I wanted to keep everything backwardly compatible (espeically the command-line, preprocessing tools). The last few days are the first time I've really attacked it and made big, non-backwards compatible changes. Mostly cutting out the cruft which I think is unnessessary, but also lots of refactoring to make it easier to change and grow.

Since the code is (mostly) alien to me, and since I want the behaviour I use to remain fixed, I've wheeled out our reliable friend - unit tests.



I really should have done this a while ago. It's only a small collection of tests - some to nail down existing behaviour, some used to drive new behaviour - but it's nice to once again have a collection of tests to run which says "everything ok" after a particularly big series of refactorings.

JUnit intergration in Eclipse is rather nice - minimal, seemless, and lets you easily step in with the debugger when things go wrong. I expect I'll have a few more tests added while I get the new behaviour in, and leave it at that for now. But any further development in this library is going to be test driven - I expect that list is going to get much bigger in time. [grin]

As an aside, does anyone else find that refactoring a big, icky piece of code is quite relaxing? Watching a nice and tidy collection of code emerge out of a horrible mess is quite facinating - especially as the end result is often better than if you'd explicitly designed it up front.
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement