Sign in to follow this  
Followers 0
  • entries
    44
  • comments
    44
  • views
    49367

A checklist for adding a new variable to a program

Sign in to follow this  
Followers 0
Norman Barrows

915 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. smile.png

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! cool.png

since you do this for each variable, you might say its a "data driven" way to go about it! (hey, i had to use at least ONE cool term somewhere, right?). laugh.png


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 )
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! blink.png
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! cool.png
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? sad.png )



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 ! wink.png

1
Sign in to follow this  
Followers 0


1 Comment


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

0

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now