Why is legacy code used at all if it has so many disadvantages? Well, it simply cannot always be avoided. Often, over the course of a project, a new programmer will take over the maintenance and further development of the code. While the original developer usually has an intuitive understanding of the code, new team members will have to develop that same understanding. Sometimes parts of the code are overlooked or not fully understood.
If a piece of code is maintained, updated, and edited by numerous different programmers over many years, that code can become a patchwork quilt as time goes on that is increasingly difficult to understand and modify. The problem is that, at some point, it will become impossible to make any required updates or modifications to the code as no one will understand it or its functionality.
Another disadvantage of legacy code is that you cannot perform regression testing (automated tests) on it because its programming is too bulky, unwieldy, and patchy. That’s why developers dealing with legacy code have to perform a significantly greater amount of manual testing. It is more difficult to fix bugs and more complicated to implement updates.