I have been wondering if I should plan ahead everything I code in advance since I tend to figure out a program as I go. When I do anything frontend, I plan how I want the CSS image or the web page to look like before I even start to code though but apart from that, I pretty much jump into it right away. I admit it would probably have saved me some time if I had just sat back and planned out the desired outcome more before I started coding.
Here is an interesting excerpt on the topic from Hackers and Painters by Paul Graham:
For example, I was taught in college that one ought to figure out a program completely on paper before even going near a computer. I found that I did not program this way. I found that I liked to program sitting in front of a computer, not a piece of paper. Worse still, instead of patiently writing out a complete program and assuring myself it was correct, I tended to just spew out code that was hopelessly broken, and gradually beat it into shape. Debugging, I was taught, was a kind of final pass where you caught typos and oversights. The way I worked, it seemed like programming consisted of debugging.
For a long time I felt bad about this, just as I once felt bad that I didn't hold my pencil the way they taught me to in elementary school. If I had only looked over at the other makers, the painters or the architects, I would have realized that there was a name for what I was doing: sketching. As far as I can tell, the way they taught me to program in college was all wrong. You should figure out programs as you're writing them, just as writers and painters and architects do.
Do you follow a particular structure while you code? Do you plan ahead or figure out programs as you are writing them?
Templates let you quickly answer FAQs or store snippets for re-use.