Facade. This article describes the Design Pattern "Facade" and its usage in the programming language Java.
The Facade Pattern provides a unified interface to a set of interfaces in as subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.
The Facade Pattern leaves the subsystem accessible to be used directly.
Assume you have a database access class with different methods to read the different tables. The client requires the complete result. You could use a facade pattern which hides the complex database access interface behind a few easy to understand and maintainable interface, e.g., load() and get().
The Facade pattern simplifies the access to an complex interface but allows still the complete access to the underlying subsystem.
The Facade Pattern allows to decouple your client implementation from the subsystem.
The difference between the Adapter Pattern and the Facade Pattern is their intent. The Adapter Pattern converts one or more interfaces to an expected subsystem interface. The Facade Pattern simplifies one or more interfaces to a subsystem. So an implementation point of view both are similar only distinguishable by their intent.
|TRAINING||SERVICE & SUPPORT|
The vogella company provides comprehensive training and education services from experts in the areas of Eclipse RCP, Android, Git, Java, Gradle and Spring. We offer both public and inhouse training. Whichever course you decide to take, you are guaranteed to experience what many before you refer to as “The best IT class I have ever attended”.
The vogella company offers expert consulting services, development support and coaching. Our customers range from Fortune 100 corporations to individual developers.
Copyright © 2012-2016 vogella GmbH. Free use of the software examples is granted under the terms of the EPL License. This tutorial is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany license.