my dog learned polymorphism*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Where to put the Business Delegate? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Where to put the Business Delegate?" Watch "Where to put the Business Delegate?" New topic
Author

Where to put the Business Delegate?

Shouton Eulle
Greenhorn

Joined: May 16, 2007
Posts: 21
Many SECAs told us their success stories that they have applied the BussinessDelegate design pattern in their solutions.
I decided to follow the proven practices. However, I am so confused how and where to put the BussinessDelegate in the component diagram.

According to BusinessDelegate( http://java.sun.com/blueprints/corej2eepatterns/Patterns/BusinessDelegate.html), this design pattern is a business service. Therefore, it sounds should be located in EJB tire. However, it is the class that should be together with SeviceLocater, and must be deployed on Web Server.

Here, is my question
1) Where to put my BusinessDelegate, in Web tire (E450), or EJB tire(E10000)?
2) If I deployed it on the web server, is it possible to make swing application to invoke it?
Swing application can access a seissionFacade directly, however, use a RMI to invoke a bussinessDelegate which located on E450� offcorse, it is not impossible, but is the solution really makes sense?

Thanks


SCJP, <br />SCWCD,<br />SCEA, <br />SCDWS(in process)<br /> <br />win like a man, lose like a man
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

Hi Shouton,

Instead of trying to force a particular pattern into your solution, I recommend you work on individual sections of your solution and work out what patterns will work. You might also review your solution at the end of the assignment and see if you can spot more patterns.

There is a risk, in the way you have phrased your question, that someone may give you a 'put this pattern here' type of answer, and you will have learnt nothing from it.

Later if someone were to ask you why you used a business delegate, you would be unable to answer them (possibly causing you to fail the exam).

Or (even worse in my perspective), if you were to get a job as an architect, and you suggested using a Business Delegate in an inappropriate place, or you failed to spot where a Business Delegate should be used, then those around you would consider the SCEA certification useless.

My challenge to everyone reading this post - this is an excellent learning / teaching opportunity. We can discuss the Business Delegate design pattern without going into the specifics of how it fits into the assignment (which, as mentioned in the SCEA FAQ is not allowed in this forum). And at some point there will be an "ah-ha" moment, where everything falls into place and we will all benefit.

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Frank Kuepper
Ranch Hand

Joined: Mar 16, 2007
Posts: 45
Hi Shoutun,

I think, you are confusing component and deployment diagrams.

A component diagram doesn't consider tiers and nodes. Therefore the business delegate can be referenced from all client componentes, that need it (for example web-interface components and swing-interface components).

As for the deployment to the different tiers and nodes, a component can be deployed to more than one tier/node. Therefore it is possible to deploy and use the business delegate in the web-tier as well as in a swing client applicaion.

As for the pattern definition: business delegate is regarded a business service as it acts as a proxy for the server side business object hiding the complexities of lookup and remote invocation. So it normally is implemented by the business component developer for use by the client components. Of course it has to be deployed alongside with any client-component, that uses it.

Hope that helps (and hope to have provided a bit of the learning experience mentioned by Andrew instead of a "put it there" )
Frank
[ July 06, 2007: Message edited by: Frank Kuepper ]

SCEA (93%/93%)
Shouton Eulle
Greenhorn

Joined: May 16, 2007
Posts: 21
hi, Frank

thanks. your kindly answer is really helpful.
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
Here is an excerpt from "Core J2EE Patterns":

Business delegates are plain Java objects that are local to the client. Typically, business delegates are developed by the EJB developers and provided to the client developers.


Diagrams in Core J2EE Patterns clearly shows that Business Delegates are at presentation tier.

Hope this clears up the confusion.
[ July 10, 2007: Message edited by: Hafizur Rahman ]

SCJP 2(94%), SCBCD 5.0(86%), SCDJWS(86%), SCEA 5 (I-73%, II/III-88%)
The illiterate of the 21st century will not be those who cannot read and write, but those who cannot learn, unlearn, and relearn. - Alvin Toffler
Devender Thareja
Ranch Hand

Joined: Jul 14, 2005
Posts: 187
Originally posted by Hafizur Rahman:
Here is an excerpt from "Core J2EE Patterns":



Diagrams in Core J2EE Patterns clearly shows that Business Delegates are at presentation tier.

Hope this clears up the confusion.

[ July 10, 2007: Message edited by: Hafizur Rahman ]

Actually It has thickened up the confusion.
The EJB developer develops it but it resides on client side? Are you talking about ejb stubs (remote interface) object?
It has to be more general then that. Experts please comment.


Devender Thareja
SCEA, SCBCD, SCJP
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
Please have a look for example here
http://java.sun.com/blueprints/code/jps131/src/com/sun/j2ee/blueprints/admin/web/AdminRequestBD.java.html
Devender Thareja
Ranch Hand

Joined: Jul 14, 2005
Posts: 187
Thanks for the example Hafizur.
I don't see why such class should be developed by EJB developer. I think use of business delegate to encapsulate the access to EJB is very much client layer architecture issue and should be done by client side groups.
This is a good example of how business delegate are used but this is not the only situation when you use a business delegate. It can be used to access any non-ejb system or to provide a functionality common to all use cases. That's how I feel.

Originally posted by Hafizur Rahman:
Please have a look for example here
http://java.sun.com/blueprints/code/jps131/src/com/sun/j2ee/blueprints/admin/web/AdminRequestBD.java.html
Ben Two
Ranch Hand

Joined: Jul 06, 2007
Posts: 35
Hi, As an experienced server-side developer I don't agree that the Business Delegate should be developed by client developer. Since EJB or other server side component like RMI,Web Service,COM, EJB are all components which means it should be easily assembled and used, which means it'll be better to supply a component with easy usage that the client can invoke it as well as local objects.

So, for me, I'll develop the EJBs and also Service Locator, Business Delegate and finally deploy to two jars, one contains EJB objects which will be deployed to application server, the other will contain Business Delegate along , ServiceLocator with EJB home and remote interface classes which will de deployed to client layer.

kind regards
Ben
sammaiah kyatham
Ranch Hand

Joined: Aug 03, 2003
Posts: 104
Yes Ben,
You are right. It is a presentation layer/client layer design pattern.
Client developer doesn't know how to access the business methods from Server components. Business delegate helps them to access the business methods easily with out any server side components knowledge.


Thnx,
Sam
Hafizur Rahman
Ranch Hand

Joined: Sep 05, 2002
Posts: 98
Though this topic is not discussed for long, recently I got some clarification about Business Delegate.

Though BD resides on Web/Client tier, this is actually a Business tier component. That's why they are generally provided by the component developer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where to put the Business Delegate?
 
Similar Threads
I'm Confused...
A service that hides Local/Remote EJB
How to lookup an EJB in Servlets?
Business Delegate and SL pattern's abilities
Any pattens before access EJB when using Struts