Good debugging skills will help you understand
everything.
Heres my tips...
1. Write a function that sends everything you need to monitor to the screen. Do it in an orderly fashion, putting related information together.
2. Create a variable called iDebug. Set it to 1. When you've finished debugging, set it to 0. Only call the debug printing function when the iDebug flag is on. That way, you never have to delete your debug info from the code.
3. Assign a key that changes the sync rate. When you press it, it will drop the Sync Rate to 5 or so, so you can watch your debug variables on screen as the application progresses. When you press it again, the sync rate goes back to normal.
4. Write a function that stops the action and prints a text string to the screen. For example, I do this to check that new parameters are loading from my parameter file correctly. Once I know they are right, I comment this fact in my code and remove the debug line.
5. Cut problems in half. If you're unsure what is going wrong, and where, put breakpoints before and after specific routines. Then you can cut out sections of code that you know are working from your debug. If you're lucky, you will see that it has gone wrong between these points and be a lot closer to the problem.
Hope this helps. The only other thing that will help is practise...keep debugging until it becomes second nature. Then, and only then, will your programming skills expand exponentially!
All the best!
Thanks in advance.
All the Best,
StevieVee