Wednesday, 12 August 2009

Refactoring and the MPL

As I mentioned a while back, Kharne will soon be going open source, under the Mozilla Public License. My reasons for doing this aren't born out of any great philosophical attachment to the Open Source Paradigm (whilst I do have an Ubuntu partition on my laptop that I do occasionally boot into, I spend most of my time in Microsoft Windows) but rather for more prosaic reasons:
  • I don't want Kharne to die through any hypothetical future lack of involvement on my own part
  • I welcome the scrutiny that other people reading and checking my code brings
  • I want there to be at least one Roguelike out there written in Delphi
The last point should not be taken as an adoption of language advocacy, though - I've long held the position that the best language is the one that gets the job done as quickly as possible with as few errors as possible meeting as many of the requirements as possible (though a roguelike developerd in COBOL would be rather amusing).

However, releasing something as Open Source doesn't just mean tacking the appropriate headers onto the top of each unit of source code. For better or for ill, the current Kharne source code is very much like the proverbial Curate's Egg. Some of it is spellbindingly excellent and some of it is just plain awful. So prior to release of the code, I'll engage is a massive code refactor and tidyup.

This refactor is something I've already started. But what does this it entail?
  • General Code Tidyup and Commenting
  • Adherence to Coding Standards
  • Removing Redundant Units
  • Proper Encapsulation of all Classes
  • Abstraction of Procedural and non-Class code into Classes (where possible)
  • Logging and Error Handling
Additionally in this exercise, I'd also like to do prepare the ground for a possible future multiplatform port (or at least remove the most gregarious incompatibilities with Lazarus).

Now all this will take time, but I don't expect there to be much delay in the release of future releases, if any at all (didn't expect me to say that, did you?). The pain now will be worth the gain in the future.


ZIZNAK said...

Hey... is this the original dave moore that created the first kharne back in 2000 i believe? I was a fan of the first attempt at kharne and have been following your progress here as well. Just want to say I'm very happy that you've decided to pick this back up and I've just started play-testing today. dont worry I wont be bothering you with any how too's or anything. I'm a vet net-hacker so just know i'm very thankful that this has "come back" so to speak

Dave said...

I am indeed he :-)

ZIZNAK said...

thats awesome. I like what i see so far and you've gotten it somewhat "playable" fairly fast. I had stumbled on this back in Feb. I'll be testing out this latest alpha version. Can't wait for magic!! til next time... I'll be watching you... muahahahahahah

Dave said...

Its actually been a hard-old grind, but I'm glad you like what I've done so far and feel free to send me any suggestions and comments!

John Greenberg said...

This decision will pay dividends, especially if you garner enough attention from the RL community that you get to the point where people are offering patches to tidy up odds and ends and add flavor.

elig said...

This is absolutely fantastic, and I think it's a wonderful decision to say the least. I'd love to get a peek at Kharne's source code! :D And, you can use sites like Google Code now to store your source. Can't wait to see the new code. Your refactoring has inspired me to consider refactoring some of my own code..