Might sound like motherhood and apple pie, but...
You should plan and design your program before you start writing code.
Not necessary to design the entire program down to the last detail.
You should at least know what the behavior of the major parts of the program will be.
(You can usually defer some of the lower-level
details until later in the development cycle.)