Have the structure of the program very clear in your mind before you ever write a single line of code. If making diagrams or outlines using paper and pencil helps you to do this, go right ahead.This is especially critical if you are writing non-trivial programs, as in more than 200-300 lines. If you have a solid plan before you start to code, you are much less likely to write useless code. It's not very much fun to get halfway through your program and then realize that there's a major structural flaw.