It’s about 7:00 pm now on a saturday evening. Got to submit a demo project which carries a bulk of my grading weightage. Sitting right here for the past 10 hrs. There’s a lot of coding still left to be done and here I am sulking to the lowest possible position on my seat and banging the keyboard typing this stuff.
I’ve been trying to find that silly dumb bug that I’ve incorporated in my code unknowingly, for the past three hours and still I see no light anywhere. Everything seems perfect, but still things don’t work the way I want them to work! The Pointer gets referenced haphazardly, the loop jerks out in a wierd fashion, the output screen beeps but still does nothing much such that I can claim to have surpassed an error. Logical errors…Link errors …Grrr!!
Wish things were better! 🙁
A few tips on debugging. Try the following
1)Break your code into smaller logical chunks. A flow chart definitely helps.
2)Set as many breakpoints and watches as you can. One breakpoint before and after each loop may be just what you need to avoid getting into the conditions you have listed.
3)Step in and out of code as necessary.
4)Do some research on segmentation faults. They are sometimes the toughest to crack.
5)Also read up on version control systems. They are immensely useful, particularly when you are working on large projects.
6)Using an IDE like MS Visual Studio and a version control tool like CVS, has helped me immensely in all the above areas.
7)If nothing works after quite an effort, take a break. Chill and get some coffee/water. There are some days I’ve just been so frustrated with bugs, only to come back an hour later to find the mistake glaring at me. YES, exhaustion increases bugs.
3 hours is too much to spend on a silly bug. Spend time on learning the above simple techniques. I assure you that programming will be much more fun and you’ll get your stuff done much faster.
See if you can learn LISP (its a list processing language). I have read a lot of positive comments on the programming approach. People say that it helps us think about programming in an entirely different way. Anyway, thats my next language to pick up once I’m out of here.