Facade in Java
Facade is a Conceptual design pattern that provides a simplified (but limited) interface to a complex system of classes, library or framework.
While Facade decreases the overall complexity of the application, it also helps to move unwanted dependencies to one place.
Usage of the pattern in Java
Usage examples: The Facade pattern is commonly used in apps written in Java. It’s especially handy when working with complex libraries and APIs.
Here are some Facade examples in core Java libs:
Identification: Facade can be recognized in a class that has a simple interface, but delegates most of the work to other classes. Usually, facades manage full life cycle of objects they use.
Simple interface for a complex video conversion library
In this examples, the Facade simplifies communication with a complex video conversion framework.
The Facade provides a single class with a single method that handles all the complexity of configuring the right classes of the framework and retrieving result in a correct format.
some_complex_media_library: Complex video conversion library
facade/VideoConversionFacade.java: Facade provides simple interface of video conversion
Demo.java: Client code
OutputDemo.txt: Execution result