Sometimes when I'm in 'idea mode' I like to just plow ahead and get something running even if the code is crappy. It gives me a chance to see the idea in action. I then go back and re-implement the idea with the appropriate code structure, unit tests, etc.
My first pass is really about proving out the idea, learning about the domain, and finding any gotchas. The second pass is about using my experience from the first pass to create a clean, maintainable base.. something that I can come back to in a month and be able to maintain, enhance, and deploy without having to relearn everything again.