This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
Joined: Jul 07, 2012
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?
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.
Joined: Jul 07, 2012
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"
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.
Regards, Sujeeth Pakala
SCJP, SCWCD, SCBCD, ICAD, XML Master Basic, Certified SOA Professional