Should I fix the terrible app I inherited? Or totally rewrite it?

Should I fix the terrible app I inherited?

Or should I totally rewrite it?

Assuming this app is larger than a one day to one week rewrite (for yourself or your team) then the question has to be asked: Do we completely rewrite this app as a new v2 or do we refactor the existing code base?

Size and scope

The biggest problem of an inherited app is that you, the new programmer, don’t really understand the problems that are being solved. Apps are full of edge cases and gotchas that you don’t know yet and won’t account for in your rewrite. This means when you go to rewrite it, you will both underestimate the time needed for the rewrite and miss critical functionality the original app had.

New tech stack

The app might also be terrible because it is the tech stack is outdated or the wrong choice for the problem domain. If you have a small application that needs a simple web-based UI and your current solution is either old and outdated or simply never meant for that kind of work, then, in that case, you should probably reach for Rails or something similar.

Big ball of mud

What if the code is beyond “just bad”. Like it really is a pain to even change the smallest thing? Like poorly-named global variables, pages of nested if statements or duplication of code everywhere? This, more than any other problem, is what would drive me to throw it away. I wouldn’t want to clean up somebody else’s mess.

My approach

Unless the app is really, really small, I say start with the refactoring. As you refactor, make estimates (and write them down) to see how long these refactors take vs how long you think they would take. This solution gives you two advantages:

  1. You keep the working app and can improve it while you gain knowledge.
  2. When you go for the rewrite you will really know what you are getting into.

All the code that you refactor should be documented, tested and written with the idea in mind that you might take it with you to version 2 when you make the leap. This saves you time while fixing up what you have.

When you start rewriting the whole app (if you do) your earned knowledge of the problem domain and the way that the app addresses the problems will serve you well. You won’t be figuring out all the problems on the fly and your rewriting estimates will be rock solid so you should complete it on time and with no big surprises.

Good luck!


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *