I'm a newer enthusiast programmer. I've been doing small and big projects on and off for the past two or three years.
I always hit small snags in my code that add up to big memory hogs or unnecessary lines of code down the road. My philosophy on big projects has always been to just 'get it out of my head' and write all the code into a working product, then going back and reducing the code to a simpler, more optimized form. However, this doesn't always work: when doing database structures, I tend to have to go back many times to add in features that come up spur-of-the-moment. Entire blocks of code have to be erased because of a spontaneous brainchild.
My question to you is, is it more efficient to write an entire program and THEN go back and optimize it, or should I optimize code as I write it?
