A checklist for adding a new variable to a program
We're programmer's. We code. We spend our time implementing stuff - making it do this, or making it do that.
Well, one of the first things we need when beginning the implementation of a new feature is variables.
So we spend a lot of time declaring and implementing variables. So much time, that i have memorized a "checklist" of the steps involved.
By following the checklist for each variable required, you're pretty much guaranteed a complete implementation for a given feature, with no parts forgotten.
The checklist is so useful that sometimes i'll think of a new feature, come up with a few new variables i need, go through the checklist, and i'm done - feature implemented!
since you do this for each variable, you might say its a "data driven" way to go about it! <g> (hey, i had to use at least ONE cool term somewhere, right?).
so now, without further adieu, here's the checklist:
When you add a variable to a program, you have to:
1. declare it (unless you use one of those cool weirdo languages <g> )
2. initialize it
3. load it (optional)
4. save it (optional)
5. change it. usually via user input somehow. sometimes by other internal game systems. if it never changed it would be a constant!
6. use it. use it to do something in the game. make it do something - have some effect. i mean - that's why you declared it right? so you could use it! hey - i need that to do cool stuff!
7. display (optional). some variables need to be displayed, some don't.
8. un-initialize. some variables need to have memory de-allocated, etc. (boy this spell checker can't spell any programming terms can it? <g> )
i memorize it as:
So there it is, the infamous checklist. Like i said, i find that if you go through and write all those bits of code, you're usually done implementing a variable. As always with game development, the usual caveats apply. there are no absolutes. surely somewhere at some time someone will make a game that requires something additional. But i've been using the first 6 on the list for over 20 years, and the last two just occurred to me while adding a gamespeed variable to Armies of Steel II.
Happy coding !