So it is with software.
So it is with software.
It provides two major benefits: 1) it lets you give yourself permission to take unwise shortcuts and h=just hack it together til it works, because 2) you've agreed with yourself it's going to get a ground up rewrite, which you'll approach with a much better understanding of the problem (and the solution and the customers and...)
(I'm much more careful these days about either writing properly secured "demo code", or at least hard-coding non-routable ip addresses into it - with comments pointing out the lack of security right where someone would need to be looking to change those hard-coded addresses…)
I started with some really ugly C# code, learned some more about OO, and tried again. Now I just have some bad C# code, but its doing what I need. I'm definitely a better programmer now than I am when I started, and maybe if I find myself a free week sometime later, I'll rewrite the whole thing again.
Refactoring is when you rework a specific section of code, usually that you're about to work on, or just worked on, to be cleaner. It's a long-term approach, and it's how large applications stay maintainable over the long term. For your specific example, you'd leave your app alone. You wouldn't rewrite it, or touch it, until you find a bug, or need to add a new feature, and then you'd rework anything you need to to add the feature cleanly.
On a related note, Refactoring by Martin Fowler is a great book, and I'd recommend everybody pick up a copy. It's a beautiful hardcover and looks great on a shelf, too.
http://www.amazon.com/Refactoring-Improving-Design-Existing-...