Jump to content

  • Log In with Google      Sign In   
  • Create Account





A checklist for adding a new variable to a program

Posted by Norman Barrows, 05 September 2013 · 463 views

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. Posted Image

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! Posted Image

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?). Posted Image


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! Posted Image
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! Posted Image
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> Posted Image )



i memorize it as:

declare-init-load-save-change-use-display-uninit



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 ! Posted Image




If you replace "change" by "modify" you get a cool anagram DILSMUDU. Yes, I have nothing better to do :P

October 2014 »

S M T W T F S
   1234
567891011
12131415161718
1920 21 22232425
262728293031 

Recent Entries

PARTNERS