In this Robots post @calebthompson mentioned the Facade Pattern to avoid instantiating more than one object in a controller per Sandi’s Rules. I might not be understanding that pattern fully, but it just seems to me like you’re abstracting the creation of a bunch of instance variables to another class, but the effective result is that the controller, in calling the Facade class, has the net effect of instantiating more than one object.
I think I’m misunderstanding the pattern. Can anyone elaborate on the Facade Pattern?
To me, I feel when we done OOD in right way, so we will have a bunch of small objects. So when you want to do or get something, it might involve from instantiating those small objects, and if you leave that knowledge in controller, it will make controller harder to test, and also we might need that kind of info again, so we don’t want to duplicate knowledge of instantiating those small objects in somewhere else. So we put in a class that represent the concept of those data/behaviors and give it a name with simplify interface to let client code easy to access.