At this point, we have made a big step forward in modernizing our legacy application. We have begun converting from an include-oriented architecture to a class-oriented one. Even if we later discover a class or function that we missed, that's OK; we can follow the above process as many times as needed until all definitions have been moved to the central location.
We may still have lots of include
statements in the application, but those that remain are related to the application flow, and not to pulling in class and function definitions. Any include
calls that remain are executing logic. We can now see the flow of the application much better.
We have put in place a structure for new functionality. Any time we need to add a new behavior, we can place it in a new class, and that class will be autoloaded whenever we need it. We can stop writing new stand-alone functions; instead, we will write new methods on classes. These new methods will be much more amenable to unit tests...