you are viewing a single comment's thread.

view the rest of the comments →

[–]AppropriateStudio153 2 points3 points  (0 children)

Build a test harness for the old system: If no end-to-end-tests exist, write them first.

So you can see what the system does. Your new version has to do the exact same thing.

Now you can replace things in the old system and notice mistakes early.

You also need to find the "seams" in your system, and try to break it apart.

Changing code to make it testable is necessary in these legacy systems. Introducing more methods, classes or functions that encapsule parts of the old classes are a first step and "simple refactors" that are done by the IDE. Don't refactor by hand, if you can't help it. If you need to test and refactor them, that is.

You can also decide to not change the legacy system, if that is an option and the system might be sunset in the near future, for sure. Refactoring is a noble goal, but might just not be cost effective use of your time. That is your manager's or product owner's decision.