Code is either used once or forever it seems. And too much of the former persists. I use a flippant reminder: "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
Know what you're trying to accomplish. Start with some idea of how to accomplish it. Iterate.