Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the differences between facade pattern and abstarct factory pattern? [closed]

I'm not asking the interview point of view. I want to know the real time scenario of implemented in the projects like the struts framework etc.

like image 420
Adalarasan Sachithanantham Avatar asked Jun 25 '12 11:06

Adalarasan Sachithanantham


People also ask

What is the difference between factory and Abstract Factory pattern?

Java. The main difference between a “factory method” and an “abstract factory” is that the factory method is a single method, and an abstract factory is an object. The factory method is just a method, it can be overridden in a subclass, whereas the abstract factory is an object that has multiple factory methods on it.

What is the difference between Singleton design pattern and facade design pattern?

The big differences will be in the lifetime and isolation of the objects. A facade over Session data will still have data that is only accessible by a single user's Session and will die once the Session is torn down. Singletons will last for the lifetime of the application and be accessible across all Sessions.

What do you mean by facade pattern?

The facade pattern (also spelled façade) is a software-design pattern commonly used in object-oriented programming. Analogous to a facade in architecture, a facade is an object that serves as a front-facing interface masking more complex underlying or structural code.

What are the differences between factory method and prototype design patterns?

Factory pattern is used to introduce loose coupling between objects as the factory will take care of all the instantiation logic hiding it from the clients. Prototype pattern on the other hand is used when the cost of creating an object is large and it is ok to copy an existing instance than creating a new instance.


2 Answers

The facade pattern is used when you want to hide an implementation or it is about changing interface of some class or set of classes. Builder hides the process of construction by decomposing it in smaller steps.

Abstract factory pattern is used when you want to hide the details on constructing instances.
Provide an interface for creating families of related or dependent objects without specifying their concrete classes.

like image 186
Sumit Singh Avatar answered Nov 08 '22 09:11

Sumit Singh


I don't know, why this was voted negatively. This is a legitimate question.

My take - A facade is a class or a group of classes hiding internal implementation/services from the user.

An abstract factory encapsulates a group of factories which are used for creating objects, whereas Facade can be used to provide abstraction to all kinds of operations, not just creation.

like image 43
Yair Zaslavsky Avatar answered Nov 08 '22 09:11

Yair Zaslavsky