0

This question already has an answer here:

I'm working on medium sized ASP.NET MVC 4 web app, that is about 2.5 years old. Around 25-30k lines of code. The project has never followed any of the good .NET design practices. It is a very tightly coupled solution. There are not interfaces at all.

Do you think it is worth to upgrade the legacy/spaghetti code to follow SOLID principles and implement some design patterns? I know there is quite a good book to work with legacy code (don't remember the actual name).

The problem is that the project is constantly growing and the cost of refactoring is also growing every time new functionality is added. I wanted to spend some time to upgrade it, but when I looked into details of doing so, it overwhelmed me. There is so many changes needed that I don't know where to start with.

Has anyone got any experience with upgrading the legacy code? Was it worth it to spend so much time on it? Any ideas where to start?

marked as duplicate by gnat, Robbie Dee, thorsten müller, JDT, Telastyn Sep 27 '16 at 12:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Not every problem requires a rewrite. Look into the BSP – Robbie Dee Sep 27 '16 at 11:30
  • In my opinion it's totally worth it if you will still work on this code in the future (i.e. update, look for bugs, etc.). But you will probably have to explain to a non-developer that a code that works fine needs some work on it. They may not want to pay for an already working code. – Tim Sep 27 '16 at 11:31
  • see also Where to start? – gnat Sep 27 '16 at 11:36
  • 1
    Recommended reading. A rewrite isn't a silver bullet. – Robbie Dee Sep 27 '16 at 11:39
  • 1
    If you think "SOLID principles" will produce a better design, you probably don't understand the existing design very well. SOLID is a set of guidelines useful in specific situations. – Frank Hileman Sep 27 '16 at 18:39
0

Everything depends on how long is this project meant to last. In addition, you need to ask yourself one important question - if you are working in a team, is your team capable of writing a better quality code than the current one?

When it comes to time:

Just a few more weeks

Any kind of rewrite don't really makes much sense at this scale - when a new feature is needed or there is a bug to fix, simply expand existing code.

Few months

At this scale, you could consider rewrite of parts of code that are actively developed and using good practices in the code written in a future, but the whole code rewrite will most likely take too much time to be worth it.

Year or more

If the project is meant to last for a very long time, I think that total rewrite could be a good idea. Rewriting the program to use good practices should take much less time than it took to write it initially (but this will still take a considerable amount of time).

Not the answer you're looking for? Browse other questions tagged or ask your own question.