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

are DAO and Business Delegate the same ? i do not understand any difference between these?

 
Monica Shiralkar
Ranch Hand
Posts: 855
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If instead of calling a functionality I create service layer and service layer calls the functionality it is Business Delegate pattern.But isnt it the same in DAO?
thanks
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both patterns are about delegating responsibility and hiding complexity, but that's about where the similarity ends. Have a look at the context and problem descriptions of the business delegate and data access object patterns. Those are pretty dissimilar. Sometimes patterns are similar in structure and implementation, so why maintain both? That is because they apply to different contexts and are proposed to solve different problems. So even if their implementations may be similar, the fact that they apply to very specific contexts still makes them invaluable communiation tools.
 
Monica Shiralkar
Ranch Hand
Posts: 855
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have Struts Action classes in WEB Folder,This calls service methods from SERVICE folder. This calls DAO methods from DAO folder. Is this business delegate design pattern?
thanks
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you put your service method calls in one object then that becomes your business delegate. It is not a DAO. It uses the DAO but that fact is hidden from the web. The web classes only ask the business delegate to perform the function and the business delegate can in turn ask the DAO or an EJB or even a webservice client to perform the task. Some people use inheritance and have their business services extending their crud classes. In that (questionable) arrangement, the service layer IS the DAO layer but note that it doesn't need to be a business delegate as well. One could still front all that with a business delegate which shields client code from the actual service layer API. If your client code knows the service layer APIs then you don't have a business delegate.
 
Monica Shiralkar
Ranch Hand
Posts: 855
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all.

Is the below understanding correct?

"DAO uses Business Delegate"
DAO is just one way of doing Business Delegate where as there is a lot more the Business delegate than its use in DAO"
 
Sujeeth Pakala
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, "Business Deligate uses DAO"

DAO basically maps to persistent layer and encapsulates CRUD operations (not necessarily on DB) without exposing details of resource (DB).

In modular design, a Business Delegate invokes methods on a Session Facade (EJB) object and uses Service Locator object to get reference to Session Facade. Business Delegate maintains one-one relation ship with Session Facade.

In turn, Session Facade uses Data Access Object class to to perform persistent operations.
BDMainSeq.gif
[Thumbnail for BDMainSeq.gif]
Business Delegate
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic