Not all legacy applications use a large set of classes. Often, instead of classes, there is a significant number of user-defined functions for core logic.
Using functions is not a problem in itself, but it does mean that we need to include
the files where the functions are defined. But autoloading only works for classes. It would be good to find a way to automatically load the function files as well as the class files. That would help us remove even more include
calls.
The solution here is to move the functions into class files, and call the functions as static methods on those classes. That way, the autoloader can load up the class file for us, and then we can call the methods in that class.
This procedure is more complex than when we consolidated class files. Here is the general process we will follow:
Find an
include
statement that pulls in a function definition file.Convert that function definition file into a class file of static methods; we need to...