Oct 7, 2015

Architecture Over Hacking


Okay, okay! I was saying it to myself and anybody else for many many times: Bros over.. err. Architecture over Hacking and rushed coding!
Don't code when you are tired or worse, exhausted. Don't code if you don't imagine final result in your mind! Spend as much time as you need for figuring out the architecture then you may code for few minutes (yes, it happens sometimes).

It doesn't mean you always get unworking code, sure not, but.. well.
For example, I have 'map validation routines'. This code is stable, relatively fast, but I sweat every single time I have to look into it. Better keep it untouched, 'Legacy Code' as it is. Except, it is Your legacy code. ^_^

The same thing happened.
If you check our Trello board you can find that I am adding Z levels to global map storage, so game can track your travels to slums, generate them and so on.
At first, I thought: 'ah. easy task, do it on fly '.
You think what?
What?
Chicken butt!
Come on, I have been coding it until understood: I am going veeery wrong way.  I made an attempte to hack a way and add a record with a dynamic array to every game location.
Ugh. bad idea! It was hard to work with even during current work! What about halve of a year later? Huh?
Yeah. Take a deep inhale, delete you crappy code and think about Architecture!
Think first, Constantine!

PS
Current task:
Class that will push new levels into self, give them to game and report errors!
Simple and elegant.
Do it!

No comments:

Post a Comment