After we have extracted all the include calls from our classes, we will have finally removed one of the last major artifacts of our legacy architecture. We can load a class without any side effects, and logic is executed only as a result of invoking a method. This is a big step forward for us.
We can now begin paying attention to overarching end-to-end architecture of our legacy application.
As things stand now, the entire legacy application is still located in the web server document root. Users browse to each page script directly. This means that the URLs are coupled to the file system. In addition, each page script has quite a bit of repeated logic: load a setup script, instantiate a controller using dependency injection, invoke the controller, and send the response.
Our next major goal, then, is to begin using a Front Controller in our legacy application. The front controller will be composed of some bootstrapping logic, a router, and a dispatcher. This will decouple...