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.
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.
The Facade Pattern is a design pattern. All design patterns are abstractions. The real question here is "What is an abstraction?".
An abstraction is when you hide some details. For example, you might have an app with with a service for each domain model (e.g. User, Item, Action, whatever). You'd like the consumer of your API to not have to know that detail (i.e. worry about getting the correct services, how to use them together, etc), so you put up a "facade", which is simply a service that does everything all those other services do, but in one interface. That's an abstraction, because the Facade user doesn't know that there are N services under the covers, nor does he/she care how they are used, because he/she just uses the unified implementation.
You've abstracted the details away, using a design pattern.