I have a question about patterns. I really have problems with design patterns. Can you tell me the differences between Facade Pattern and Builder, Factory and Abstract Factory patterns?

share|improve this question
1  
_______homework? – Grzegorz Oledzki May 3 '10 at 20:05

Those and also other patterns might often look quite similar. The difference is in the design decisions you made to use a pattern.

Facade is about changing the interface of some class or set of classes. Builder hides the process of construction by decomposing it in smaller steps. Factories are about hiding the concrete implementation or instantiation of an object or object graph.

The confusion might come from the fact that often Builder in a way changes the interface of an object to allow a better way of construction, which could be also done by a Facade. It is similar with Factories.

So don't forget about small differences in the implementations of those patterns and that the most important part about design patterns are the design decisions you make.

share|improve this answer

The Facade pattern abstracts details away from the developer and makes a certain portion of code easier to use.

The Builder pattern separates the construction of an object from its representation. That makes it possible to use the same construction process across multiple types.

The Factory and Abstract Factory both deal with instantiating a related set of classes based on certain parameters used when the call to the Factory is made.

share|improve this answer
    
So I looked it up dofactory.com/Patterns/PatternFacade.aspx#_self1 and as is usually the case with patterns I thought: I probably used the pattern somewhere without knowing what it is called. – Hamish Grubijan Jun 26 '10 at 23:23

The facade pattern is used when you want to hide an implementation or otherwise make available a different interface externally. The builder/factory pattern is used when you want to hide the details on constructing instances.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.