S Surashu
- Quote
- Report Post
- Posted: Wed, 01 Feb 2012 10:58:45 +0000
Lanackse-Kanvae
1. Name your variables something sensible. Nothing is worse then revisiting projects and wonder what the ******** BLAHBLAH was meant to do.
2. Pay attention to the reserved words in your language to avoid accidentally naming variables as them and then wondering why your program went wrong. Reserved words are words reserved by the language for specific purposes. For example, If and Else are reserved for selection loops
2. Pay attention to the reserved words in your language to avoid accidentally naming variables as them and then wondering why your program went wrong. Reserved words are words reserved by the language for specific purposes. For example, If and Else are reserved for selection loops
I don't think I'll run into frustrating BLAHBLAH variables or reserved words on any language (as far as I know) because I name my variables as follows:
tVar = A temporary variable.
lVar = A local variable.
gVar = A global variable.
So hopefully, that should keep me away from crossing over to reserved words. Plus it would also help me determine if I intended a certain variable to be global, temporary, etc. 3nodding
Lanackse-Kanvae
3. Plan. Plan. Plan. Plan what your program will do and how it will do it. This includes any "modules" or APIs that you might be using or referring to. After you've planned out what the program will do, write it down in what is known as structured language. Sample given below for a dice roller.
Structured language sample
Create variable "rollDice"
Create variable called "modNumber"
Create a variable called "total"
Bring up a message asking the user what dice they want to roll and then refer to the rolling module to get it and bring it back here.
Bring up a message asking the user what they wish to add to the result of the rolls and put that into the variable "modNumber"
total = rollDice + modNumber
Bring up a message saying "You rolled (total) on this roll"
Ahh this is one of my weak points. You see, when I open up a code editor to start on a project (not work related) I basically just start coding and let my thoughts unfold as to what I want to code as I'm coding it. Sort of like just go where my mind takes me kind of thing. sweatdrop