In a larger system with more comprehensive MasterController tests in place, having all of that object creation hard-coded inside the private implementation will cause problems because of the tight coupling between the MasterController and its dependencies. One option will be to create all the other objects in main() instead and inject them into the MasterController constructor as we have done with the other controllers. This will mean injecting a lot of constructor parameters, and it is handy to be able to keep the MasterController instance as the parent of all the other objects, so we will inject a single object factory that the controller can use for all of its object creation needs instead.
The critical part of this factory ...