File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Facade Pattern in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Facade Pattern in Java " Watch "Facade Pattern in Java " New topic

Facade Pattern in Java

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Sometimes i am coming across the term called as Facade in terms of Java Programming when calls are being made from one Object to another which are internally passing Data beyween the Method calls

For Example i have seen this below comment on to a Java class

Description: This class is used as facade on configuration clas to fetch different values.

Please tell me what is meant by Facade actually , as far as my knowledge i knew only Sessionfacade where we use it fro calling EntityBeans from SessionBeans .

Can anybody please explain this Facade .Thanks in advance .

Save India From Corruption - Anna Hazare.
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

The Facade pattern.

[My Blog]
All roads lead to JavaRanch
kamal khanna

Joined: May 10, 2011
Posts: 6

* Facade
* Provides a Single interface to a group of interfaces in a subsystem.
Use when

A simple interface is needed to provide access to a complex system.
You need to reduce coupling between system implementations and clients.
You need to layer subsystems.*/

/*output : FirstClass
there are 5 classes FirstClass,SecondClass,ThirdClass,Facade,FacadeClient class in this
Inside FacadeClient Class facade class calls its method operationA()
and also Facade class contains a reference of all
three classes(FirstClass,SecondClass,ThirdClass)
which in turn calls method of classA
ie here we are hiding complexities by
providing nesting callingwe just have to call operationA()
which internally calls classA method printFirstClass
Arnold Reuser
Ranch Hand

Joined: Nov 20, 2003
Posts: 196
To answer this question
Please tell me what is meant by Facade actually

Hopefully the following metaphores will clarify the facade pattern :
* Facade as the name suggests means the face of the building. The people walking past the road can only see this glass face of the building.
They do not know anything about it, the wiring, the pipes and other complexities.
The face hides all the complexities of the building and displays a friendly face.
* Consumers encounter a facade when ordering from a catalog. The consumer calls one number and speaks with a customer service representative.
The customer service representative acts as a facade, providing an interface to the order fulfillment department, the billing department, and the shipping department.
I agree. Here's the link:
subject: Facade Pattern in Java
It's not a secret anymore!