Even though the recreation of old and messy code seems tempting at first, it’s normally an enormous task to accomplish. Planning and implementation will take a lot of time and resources till completion and it’s not guaranteed that the result will be as expected. The biggest setback would be that while the recreation progress is still continuing, no new features or improvements can be developed eventually putting a hold to the whole project. In some cases a full recreation of the code might still be the best or only option, but the development team need to take precautions to make sure the new code base will be well maintained.

Refactoring, on the other hand, seems like a tedious and lengthy task without much outcome and the risk of breaking otherwise functional code. That’s true if it’s applied to an old and poorly maintained project. Refactoring is not a one time event, but a recurring task to ensure a healthy and well kept code base. The advantage of refactoring is that it’s possible to exert small improvements with relatively slight effort, given all the changes can be checked with a functional and up to date testing framework to ensure the validity of the code. This reduces the risk of implementing new bugs to the code base. For short the advantages of refactoring are:

  • Refactoring improves the overall design of a software project
  • Refactoring makes software easier to understand
  • Refactoring helps finding bugs and programming mistakes
  • Refactoring allows to program faster

But all these advantages come with a set of possible issues:

  • Refactoring might slow down new features
  • Refactoring might interfere with code ownership
  • Refactoring might influence the work with branches in versioning systems
  • Refactoring needs intensive testing

Some of the advantages and disadvantages seem to collide. This is based on when and how refactoring is used. It might take several refactoring steps till the code base provides the fast and understandable way of programming. A more prominent issue would be that refactored code might perform worse in comparison, which is a significant disadvantage for real time applications. All in all refactoring is a mighty tool for the improvement of a messy code base, given the dedication to steadily apply the refactoring mechanics.

Diana Hille
Diana arbeitet seit 2015 für die B1 Systems GmbH. Ihr Aufgabenfeld umfasst vielfältige Themen aus dem Web- und Softwareentwicklungsbereich. Ihr Ziel ist die kontinuierliche Verbesserung der Benutzeroberfläche und der Funktionalität im Hintergrund. Daher bildet sie sich in Bereichen des DevOps und der Anwendungsentwicklung stetig weiter.

This site is registered on wpml.org as a development site. Switch to a production site key to remove this banner.