Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between an Abstraction and a Facade?

What is the difference between an 'Abstraction' and a 'Facade'?

Is there a difference at all? Or are the terms interchangeable?

like image 833
willem Avatar asked Feb 18 '10 12:02

willem


People also ask

Is facade same as interface?

No, I's not the same. For implementing Facade design pattern is not necessary to implement any interface. It just provide a new layer to communicate to your services, as an example. So it will give you one point to communicate with all services that are related.

What is difference between facade and factory design pattern?

The main difference between factory and facade design pattern is that factory is a creational design pattern that defines an interface or an abstract class to create an object, while the facade is a structural design pattern that provides a simplified interface to represent a set of interfaces in a subsystem to hide ...

What is facade for?

Usage. A Facade is used when an easier or simpler interface to an underlying object is desired. Alternatively, an adapter can be used when the wrapper must respect a particular interface and must support polymorphic behavior. A decorator makes it possible to add or alter behavior of an interface at run-time.

What is another name of facade design pattern?

Facade is a part of Gang of Four design pattern and it is categorized under Structural design patterns.


2 Answers

The facade pattern is an simplified interface to a larger, possibly more complex code base. The code base may be a single class, or more. The facade just gives you a simple interface to it.

Abstraction, is used to represent a concept, but not to be bound to any specific instance. (Ie: An abstract class). This doesn't imply simplifying (like the facade pattern does), but rather making a 'common' interface or representation.

like image 59
Clinton Avatar answered Sep 21 '22 17:09

Clinton


Facade is a specific design pattern, meant to hide the internal stuff inside a package / module from its clients behind a well-defined interface. It usually hides several interfaces/classes behind a single common one, hence its name.

'Abstraction' is a general term, meaning to hide the concrete details of something from the outside world.

So these two are not interchangeable terms.

like image 22
Péter Török Avatar answered Sep 20 '22 17:09

Péter Török