Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Facade vs Bzns Delegate

 
faiza haris
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference btw the two and which is used when?
Thanx
faiza
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, in my simple terms. A Session Facade will take a complicated system, and provide a simple to use interface to that system. That is what a Facade does. As far as Business Delegate, It seperates the Gui side from the Business Implementation.
Actually I would believe you would want to use both of these in a design.
First the Business Delegate to seperate the GUI from the business Logic. The Business Delegate might have a reference to the Facade, so that the coding in the Delegate us small and simple. The Facade would make the complicated code underneath it easy, as you wouldn't need to know that part of the implementation.
Hope that helps
Mark
 
Chintan Rajyaguru
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Session facade is usually a stateless session bean and delegate is aplain java class. Now, think of an architecture where you have connection to Database, connection to some lagacy system, you are also using messaging to talk to other system(s) and blah blah blah. In such cases you might have multitier architecture where you might have business components, Data Access Objects and so on. Processing all this becomes very complecated. You use session facade as an entry point to your complicated tiers. Session facade might call methods on business components, or might call Data Access layer for DB operations or might do something else. Main objective of session facade is to hide underlying complexity from client (who calls session facade).
Delegate as the name suggests delegates tasks to the next layer (in many cases facade as Mark said) and hence adds a layer of abstraction (or indirection) between presentation layer and biz layer.
If all this is overwhelming, think of delegate as a door between presentation layer (servlets, JSP) and biz logic and think of session facade as a way to access complex systems of back end tier.
Client // in presentation layer
{
Delegate d = new Delegate ();
d.doMyStuff (); // this is all client as to do
}
Delegate
{
// jndi look up on facade
// facade is remote interface below
facade.bizMethodCall ();
}
Facafe
{
// complex stuff
}
Above is very rough idea. People suggest corrections if I said something wrong.
Hope this helps
Chintan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic