You know, you constantly see people on the different forums talking about making your code modular. Dont hard code this. Dont hard code that value.. blah blah blah.. You’ll never be able to reuse that without rewriting it.. blah blah.. stick it up… nevermind..  In your mind you’re thinking, who cares?! It’s not like it makes a difference! It’s MY code not yours.. So, in an effort to hurry things along, and knowing for an absolute fact that you’re not going to have to change this menu class.. its perfect.. you hard code a *LOT* of values into it.

Well, someone offered some feedback on Kollectiv360 about increasing the size of the menu. When I built the menus, well, I was in a hurry and just wanted to make it work. So, to save a lot of time and math… I *HATE* math… I hardcoded a lot of values into the menu.. Well, I’ve now spent the morning undoing all that, figuring out where on earth I got some of those values from and rewriting it to be a lot more flexible. Not to mention debugging it for the second time trying to figure out why it doesnt do now what I already had it doing once…

The advantage here is I can now change one variable and resize the entire menu. The scrolling, rotating and zooming will all still work perfectly, but I can resize it at will to find what works best.

The lesson here though, is if you have the oppurtunity to do it right the first time, then do it right the first time. It may take longer, and you may have to think about your code a lot more and … oh crap.. PLAN… but otherwise invariably your going to spend hours rewriting your code and scratching your head trying to figure out how and where you came up with:

if x > 537 & x < 539

….  While that may look a lot cleaner than something like this..

if x > basePos + ((blockWidth / 2) * 7) – 1 && x < basePose + ((blockWidth / 2) * 7) + 1

you know, it’s not..

It’s worth taking the time to do it right I guess…

{grumbling and unwillingly acknowleging that those people might have had a point.. grrrrrrrr }