• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference between the facade and the business delegate pattern

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the difference between the facade and the business delegate pattern?
as per my understanding.. both act as a layer. between the presentation and the business layer..
 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not a servlet question.
I think it should be under "OO, Patterns, UML and Refactoring".
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Business Delegate *is* a Facade. The Facade pattern is much more general, though - it is not at all restricted to be used as a layer between presentation and business layer, for example.

Many of the "J2EE patterns" are in fact variations and/or specializations of the original GoF patterns.
 
Ranch Hand
Posts: 1170
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A Facade is not a layer. Its a fake layer. Hence the name, facade. It only looks like a layer from the outside, but thats just an illusion. It has no insides but to merely relay calls onto another object.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think we could define "layer" so Facade could be one. Or not.

The intent of Facade is to provide a unified and simplified API to a set of, well, less simple objects. My best experience with it was when we had several teams building components in parallel. When I needed a new API from the Contract team they could put a new method on their Facade and make it return some canned value that I could test with in minutes. Then they could huddle and design a real implementation at their leisure. I never had to see all the little implementation objects they had inside their component.

The intent of Business Delegate is to hide all the complexity of remote calls. They often double up as service locators. If I build an EJB server I can give clients a POJO delegate that they can call like any other object without knowing a thing about EJB remote calls. I use a vendor product with business delegates with multiple protocol implementations - local calls, remote EJB, proprietary raw socket protocol, XML/HTTP, etc.

Both are focused on making life easier for clients. If you write all the code from end to end that may not seem important. If you publish an API for everyone in the Enterprise to call, ease of ouse may make or break acceptance.

They're just good OO stuff some times, too. I would not be surprised if the "information hiding" value could make either or both worth while in many systems, even if I write the whole thing solo.
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree completely with Stan. Just a couple of my own thoughts to expand on this (please tell me if you disagree).

Facade presents a simplifed view of a subsystem. It does not have to expose all of the subsystem, and clients can still access the subsystem directly if they desire. The common way people think of Facades (in J2EE anyway) is a session bean.

Business delegate protects a client from aspects of the system that are not business logic, eg the remoteness of a session bean. This makes the business delegate a client side pattern. In terms of implementation it may well look very similar to the thing it is protecting the client from, but may layer in other services such as caching.

Regards

Ramen
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the structure perspect, I don't see much differency between them. They just describe similar things in different contexts. In J2EE, business delegate does sound better than facade.
 
Stan James
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see them on opposite ends of the remote protocol pipe. A facade might well have a business delegate.
 
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic