Re: Need help with my logic
- From: Mark Space <markspace@xxxxxxxxxxxxx>
- Date: Mon, 09 Oct 2006 22:57:06 GMT
Patricia Shanahan wrote:
See http://home.earthlink.net/~patricia_shanahan/debug/ for my favorite
approach.
I didn't read all the way through that, so sorry if I missed this, but there's two things I thought I'd mention, since the OP says she couldn't understand the link.
1. Hand Execution
Learn how to execute your programs by hand. This is probably the best thing you can ever learn if you are a programmer.
Print out your program and go through it line by line. Write variable names on a piece of paper as you encounter them, and write their value next to them. When the variable changes value later, cross out the old value and write the new one next to it on the right.
This will solve a lot of problems, and also make you much better about designing programs in the future.
2. Divide and Conquer
Once your programs get very large, you really can't hand execute the whole thing any more. Learn how to divide your program into chunks (modules, classes, methods, subroutines, etc....) Then make sure each chunk is working correctly before putting them all together. This will save you a lot of time when you write (and debug) large programs.
Also see "Unit Testing."
Ok, good luck.
.
- Follow-Ups:
- Re: Need help with my logic
- From: Martin Gregorie
- Re: Need help with my logic
- References:
- Need help with my logic
- From: TechGurl
- Re: Need help with my logic
- From: Lew
- Re: Need help with my logic
- From: TechGurl
- Re: Need help with my logic
- From: Patricia Shanahan
- Need help with my logic
- Prev by Date: Re: JVM crash while loading native dll using TOMCAT
- Next by Date: Re: Concurrent file read approaches?
- Previous by thread: Re: Need help with my logic
- Next by thread: Re: Need help with my logic
- Index(es):