Tuesday, July 28, 2009

Refactoring is almost done

I'm nearly complete with my refactoring. I've also pulled all of the hard-coded human stats and all of the changeable information out of the classes, so that they can be kept outside (and later) will be contained in text files. I've also chosen to separate most of the standard 'costs' for things and contain all of this as a 'rule set' or something.

One of the most annoying reasons that I chose to refactor, besides realizing just how much in common many of my classes were, I found that the original way I'd been labeling my methods became horribly unworkable the larger my code got. I'd been naming things like, 'getThisThingy' and 'calculateThisThingy' (where these to both are in reference to 'ThisThingy.' when ordering the methods by alphabetical (or any other order) it was hard to keep track of which things were in refrence to what. All of my methods now are of the sort, 'thisThingyGet' 'thisThingyCalculate'

I continue to be amazed at how much I've learned so far in this process. Once I finish my external functions to actually set up the agents and I make sure that I haven't introduced any new bugs during my refactor, I'll likely 'fix' my messy equipping-related code. Seriously, it's incredibly horrid. You don't want to know. (it's not 'hacked' in or anything, it mostly is the way it is because I was OVERLY worried about somehow using it to cheat and dupe items, etc.)

No comments: