This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confused in Design Patterns

 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

Sometimes, I find it difficult to choose between Fascade and Business Delegate design patterns. Both are used to reduce coupling between business tier and presentation tier.

Regards,
Khushhal
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe the following link can be helpful

Difference between Session Facade and Business Delegate
 
Sundaram Karthick
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Access to business component for the view are directed through the business delegate to session facade which access the required business components. Although both business deligate and session facade access service locators and both belong to Business tier - Business delegate is more of a presentation interface to access business components through the session facade.
The main purpose of BD is "You want to hide clients from the complexity of remote communication with business service components. " (from Core J2EE problem statement).Refer Business deligate. Hope this answers your question
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the Business Delegate with POJOs or EJBs. Sesson Facade is used with EJBs only
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no session facade pattern at the exam.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's say you mail your resume/CV to a big company. The post office is like a business delegate business because it abstracts away the remoteness between you and the company... ok my analogy isn't perfect because you have to write the JNDI, er, address on the envelope and the post office might give you a RemoteException, er, Return to Sender - No Address Found. A real business delegate would know the address (or ask a service locator) and will usually wrap a RemoteException in a custom business exception.

OK, so the company received your resume/CV and it goes directly to HR because HR is the session facade. The HR rep will communicate with the IT departments, CEO, and whoever else needed in deciding whether to bring you in for an interview. Your resume/CV does NOT go directly to any other business components, er, employees! Not even if those people are needed to make the hiring decision! This is great because the other employees don't need to know how to be HR people in addition to their other duties. We keep a separation of concerns and so the resource manager only needs to know: "I need a good SCWCD programmer that understands business delegates and session facades!" And HR knows right where to find one.
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok Marc

Business Delegate is all about hiding the remoteness of the Objects/Components.
Even if the components you are accessing are remote, but they appears to be local to you.
And it does all this with the help of Service Locator (an another design patter) which in turn makes use of JNDI, RMI or other registeries.

And Session Fascade just adds an another layer between the interface and implementation to keep them seperate.

Mark, am I right?

Regards,
Khushhal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic