aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes are DAO and Business Delegate the same ? i do not understand any difference between these? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "are DAO and Business Delegate the same ? i do not understand any difference between these?" Watch "are DAO and Business Delegate the same ? i do not understand any difference between these?" New topic
Author

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

Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 644
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

Joined: Mar 10, 2008
Posts: 1770
    
    7

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.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 644
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

Joined: Mar 17, 2012
Posts: 892
    
    9
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

Joined: Jul 07, 2012
Posts: 644
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

Joined: Mar 24, 2009
Posts: 94
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.



[Thumbnail for BDMainSeq.gif]



Regards, Sujeeth Pakala
SCJP, SCWCD, SCBCD, ICAD, XML Master Basic, Certified SOA Professional
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: are DAO and Business Delegate the same ? i do not understand any difference between these?