Quote Originally Posted by mog View Post
1. Write one line
2. Compile
3. Fix error(s)
4. Write another line
But that's a purely syntax-based approach. Just because your program compiles doesn't mean it's not full of errors. Eventually you get the hang of the language and don't make syntax mistakes anymore -- or only rarely -- but that doesn't mean your code is bug-free.

I'd suggest that you should write code non-stop until you run out of ideas. As soon as you find yourself thinking, "Hmm. I'm not sure how to do this next part..." that's a good time to stop and compile. This avoids creating a break in your concentration. The result will probably be a thousand syntax errors -- that's OKAY. Just look at the first one, and go fix it. Recompile, and repeat. Don't try to fix all the errors in a single pass. Often times, many errors all stem from a single typo. You may find that 3 different typos can create hundreds of errors.

Avoiding the break in concentration is very important while in the learning phase. Switching between problem-solving mode and syntax-fixing mode can be taxing.