Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Facade Pattern in Java

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Facade pattern.
 
kamal khanna
Greenhorn
Posts: 6
Hibernate MyEclipse IDE Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/*
* 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
Posts: 196
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic