Pregunta

In the documentation of the Façade pattern, the following statement appears in the discussion of related patterns:

"Abstract Factory can be used with Façade to provide an interface for creating subsystem objects in a sub- system-independent way."

How can Abstract Factory can be used with Façade in this way?

¿Fue útil?

Solución

If you think of each pattern independently first, you may find the connection yourself. First, think of the Abstract Factory pattern. This creational pattern has to do with creating an interface that allows creation of families of objects. For example you create interfaces that show how a form can be created. Then you have concrete implementers(implementers create different types of buttons, titles, etc).

Now all this can be really complicated if the family of objects to be created form a complex subsystem. Now you can use the Facade pattern(structural pattern) to handle this complexity and create a higher level interface that let's say accepts an argument as the form type and creates all the buttons, titles, sets their location, etc for the user of the facade so they don't have to handle/know details on the complex subsystem.

Otros consejos

Abstract Factory can be used to create the interface for the Facade Pattern. Abstract Factory individual factories that have a common theme without specifying their concrete classes. Where as Facade hides the complexities of the system and provides an interface to the client using which the client can access the system. To get more clear picture follow this Link.Best Practice of Facade

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top