Starting over vs. Refactoring

I have no idea what the data behind this is but my feeling, based on experience, tells me that starting over on many code-related projects is more efficient than refactoring or continuing to merely “edit.”

I suspect this applies to many disciplines.

The decision on which course to depends on many variables. The key variable is your skill level when you first started the thing vs. where you are now.

With natural language writing you’re usually just writing it now (or over the course of a few weeks) and then releasing it and then moving on with your life.

Code, however, continues to live with you as you use it–and patch it and modify it. It’s a little different in this way. You can be constantly tweaking it; never content and always spotting new things.

You can sometimes use a little script or app you created for years until finally you realize, “I keep using this thing and it’s so hard to maintain and I have advanced so much that I am just going to freakin’ rewrite it from scratch. I know so much more now about what it can do and where it’s evolved to and I am a much better programmer today than I was a few years ago so I am just going to start over on this thing!”

A novelist would never do this. It is what it is. It’s out there. I finished it. I told that story. Maybe it wasn’t perfect but I’ve moved on. I leave it imperfect.

Coders seems less content, I think; always seeking optimization.

Of course, by “starting over” it’s not truly starting over. It’s really a form of refactoring but you do start with a blank code editor or blank page to restructure and rethink everything. You’ll 100% use stuff from the original product but my main point in here is a way of thinking: When writing in a natural language it’s called “editing” and I associate this with small modifications throughout but with code I am arguing that if a sufficient amount of time has passed and you’re the only writer of this program, it’s likely that you’ll actually get a much more organized, faster-running and easier-to-maintain-program if you just start over.

I’ve wasted hours looking at old backups of code and trying to piece things together when I should have truly just extracted the main ideas and principles and some code snippets, deleted the rest and just started over with my superior skills and much deeper understanding of what this app should be and how it should be organized.