As Rob Farlay say's its the best way to debug your program. I program a lot. Mostly for simple programs that i want to make some things simpeler.
If i make a program i use always a couple of steps before i start to write the program.
1. I write down the idea on paper. And make a screen layout of the screen i think i wil needed.
2. Stil on paper is start in global steps what the program must do. Then i start to devide the steps in smaller steps.
I do this untile i think all steps are smal enough to start programmingen.
3. i try to find out where i can use function or subroutine. A big number of steps i have made go under that.
4. i have a library of smal functions and subroutines. dig in there and look at the disciption of how the function supposed to work. Make a new project folder and copied all the files i needed to there.
5. Then i start to make the program first by only putting in remarks. And a global variable called Program_Step$. In all the remarks i put in the step desciption in Program_Step$.
6. Now i start to make the source code. Even if the lines are inserted many time i add a remark at the end line
7. Save the source code on a backup folder. if i make a ugly mistake i can always take a step back.
8.if the program runs first time the Global debug is on true so the function wil call almost on every step. Even te debug log turns on.
This all gives me a good idea of how the program supposed to work. and there is always a little mistake. because of all the debug info its easy to find and correct them.
Its look like that it is a lot of work. But remenber that even great programmers work first on paper before they start programming. After programming thats 40% comes 60% debugging and testing.
Example. I had made a program that puts a puzzle together. If the player does it good he goes to the next level. What i not calculated in the program was that the player not even come trough level 1. So his score would be zero. My program was already working for a couple of mounths. And them somebody come and make no score. The program crashed. NO GOOD. But because i had break down my program i little pieces and al the step was a single program block. it was easy to repair that.
Because of the many remarks it was easy to pic u the program good. (If you see your program source code not for a long time. Then it is hard to get in the program if there is no remarks.)
I hoop i give you a tip of making and debugging you program.
If i make a program i use always a couple of steps before i start to write the program.
1. I write down the idea on paper. And make a screen layout of the screen i think i wil needed.
2. Stil on paper is start in global steps what the program must do. Then i start to devide the steps in smaller steps.
I do this untile i think all steps are smal enough to start programmingen.
3. i try to find out where i can use function or subroutine. A big number of steps i have made go under that.
4. i have a library of smal functions and subroutines. dig in there and look at the disciption of how the function supposed to work. Make a new project folder and copied all the files i needed to there.
5. Then i start to make the program first by only putting in remarks. And a global variable called Program_Step$. In all the remarks i put in the step desciption in Program_Step$.
6. Now i start to make the source code. Even if the lines are inserted many time i add a remark at the end line
7. Save the source code on a backup folder. if i make a ugly mistake i can always take a step back.
8.if the program runs first time the Global debug is on true so the function wil call almost on every step. Even te debug log turns on.
This all gives me a good idea of how the program supposed to work. and there is always a little mistake. because of all the debug info its easy to find and correct them.
Its look like that it is a lot of work. But remenber that even great programmers work first on paper before they start programming. After programming thats 40% comes 60% debugging and testing.
Example. I had made a program that puts a puzzle together. If the player does it good he goes to the next level. What i not calculated in the program was that the player not even come trough level 1. So his score would be zero. My program was already working for a couple of mounths. And them somebody come and make no score. The program crashed. NO GOOD. But because i had break down my program i little pieces and al the step was a single program block. it was easy to repair that.
Because of the many remarks it was easy to pic u the program good. (If you see your program source code not for a long time. Then it is hard to get in the program if there is no remarks.)
I hoop i give you a tip of making and debugging you program.