Facade Design pattern and Abstraction

design-patterns, java, oop

Solution

From Wikipedia:

A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can:

make a software library easier to use, understand and test, since the facade has convenient methods for common tasks;

make the library more readable, for the same reason; reduce dependencies of outside code on the inner workings of a library, since most code uses the facade, thus allowing more flexibility in developing the system;

wrap a poorly-designed collection of APIs with a single well-designed API (as per task needs).

An adapter is used when the wrapper must respect a particular interface and must support a polymorphic behavior. On the other hand, a facade is used when one wants an easier or simpler interface to work with.

This means that the facade is an actual object with behavior, not an interface. Whereas the role of an interface is to specify what operations must be supported by an implementation, the facade provides easy/convenient ways to use a body of code (e.g. a whole library), by for example providing commonly used setup, default values, etc.

Problem

what is the difference between facade design and abstraction in java? i simply feel that it is as simple as interface in java and serve the same purpose. I saw more about people saying that it is a first contact for client, hiding more interfaces and classes. but all the above are also the purpose of interfaces.!!! Confused here!!!!!!. Please give a small example and help me around. thanks, Punith

Original source