The short answer is, switching factories, what they do - the whole point of this factory style is to centralize the build logic in one place, and not that it is littered around the code base.
As long as you don't use Static factory and coding in the IRoomControllerFactory interface, you get all the usual OOP benefits of replacing it at run time / for testing - after all you say "Yo RoomControllerFactory", give me room for this magic identifier! "
As another answer to your question, you may ask yourself why you need so many specific instances of RoomController? Perhaps in favor of composition over inheritance, could you reorganize things instead of Builder instead?
source share