Forums Register Login

Club Business Delegate with Command Pattern, pros-cons

+Pie Number of slices to send: Send
Is it required to use a Business Delegate when using a Command Pattern ?
------------------------------------------------------------------------

By definition of a front controller with command handler patter
--------------------------------------------------------------
Implementing a front controller with a command pattern not only simplifies a session facade interface, it also keeps the controller implementation cleaner by encapsulating event- and request-handling tasks into smaller objects. It also enables Java platform events to be used as the bridge between Web- and EJB-tier controllers

Motivation to use a business Delegate
-------------------------------------
The Business Delegate may shield clients from possible volatility in the implementation of the business service API. Potentially, this reduces the number of changes that must be made to the presentation-tier client code when the business service API or its underlying implementation changes.


My question:
-----------
Cant we use the commandHandler itself to shield the presentation layer from the possible volatility as mentioned above ?
+Pie Number of slices to send: Send
Hi Deepak,

You can do a lot.

You gain always something: postiv and negativ characteristics. ...

IMO: Decide by you own and state the benefit of your decision.

I would still use the Business Delegate.

Lucy
+Pie Number of slices to send: Send
Deepak

Welcome to JavaRanch.

Unfortunately your name does not comply with our naming policy. Please take a quick look at the rules and edit your profile accordingly.

Thank you!
+Pie Number of slices to send: Send
Any more inputs on this....Guys I need views from this forum !!
+Pie Number of slices to send: Send
Hi, Deepak.

IMHO.If you mix the two types of code (request-handling , comunication with business service) you aren't shielding the business service API!

Alur's (the other Deepak) suggestion : Use Business Delegate whenever you have comunication with remote business compoments.(Page 302)

Thats's besides having a command pattern or not.

[ May 18, 2005: Message edited by: John Arau ]
[ May 18, 2005: Message edited by: John Arau ]
+Pie Number of slices to send: Send
Hi, John.
Thx for the answers
I did read Alur's explanation of having a Business Delegate when using Remote Business Components and shielding those remote exceptions and bo access code.

My doubts come after reading sun's blue-print.May be i dont quite understand it.

Typically as per Sun's Blue-prints, they have shown a Class Diagram
(http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/app-arch/app-arch5.html#1107803)

which depicts using both FrontController-->CommandPattern->Session Facade
and also a Business Delegate. The Business Delegate is being used only during data retrieval part.
They clearly mention that one shud use Business delegate when you are trying to retrieve data (Read). I am not quite convinced. Why cant we do without Business Delegate and use the same architecture of FrontController-->CommandPattern->Session Facade-->Business Delegate-->Business Objects for retreiving data.

As per sun's blueprint the explanation for using Business Delegate quite like Alur..But what is confusing me is that Business Delegate is not being used when request is coming via controller-->command-->sessionfacade-->business object. But only during retrieval.

You can refer to the explanation the above mentioned URL.

Any ideas here ?
+Pie Number of slices to send: Send
I think we can use both of them at the same time. Why not? Will they conflict?
+Pie Number of slices to send: Send
HI All
petstore also says that a framework should always be preffered. But are we suppose to use framework like spring,struts,tapestry in scea part 2. If yes , do we have to show internal composition of chosen framework.

THanks
kundan
+Pie Number of slices to send: Send
Deepak,
Besides decoupling business components from invoker, business delegate handles remote calls and convert remote exceptions to those that are suitable to the invoker.

Cant we use the commandHandler itself to shield the presentation layer from the possible volatility as mentioned above ?



Considering command pattern, CommandHandler is a receiver-- receiving the request and execute certain operations. In this case, I don't think the receiver can be responsible to shield the presentation layer...

My doubts come after reading sun's blue-print.May be i dont quite understand it.

Typically as per Sun's Blue-prints, they have shown a Class Diagram
(http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/app-arch/app-arch5.html#1107803)

which depicts using both FrontController-->CommandPattern->Session Facade
and also a Business Delegate. The Business Delegate is being used only during data retrieval part.
They clearly mention that one shud use Business delegate when you are trying to retrieve data (Read). I am not quite convinced. Why cant we do without Business Delegate and use the same architecture of FrontController-->CommandPattern->Session Facade-->Business Delegate-->Business Objects for retreiving data.



The document mentions about two approach: remote architect and local architect. For local architect, business delegate is not recommended. For the remote architect, a model can be an entity bean with remote access. In order for the view to access up-to-date data on this model, the view will need to use business delegate which uses service localor to look up the entity bean and access a snap shot of the entity bean state in the value object.


As per sun's blueprint the explanation for using Business Delegate quite like Alur..But what is confusing me is that Business Delegate is not being used when request is coming via controller-->command-->sessionfacade-->business object. But only during retrieval.

You can refer to the explanation the above mentioned URL.

Any ideas here ?



The controller creates an event, which is a command, then passes the event to the EJB controller which is a stateless session bean. In my opinion, if business delegate is being used, it should have been used here to decouple web tier from ejb tier.
+Pie Number of slices to send: Send
 

Originally posted by vu lee:

The controller creates an event, which is a command, then passes the event to the EJB controller which is a stateless session bean. In my opinion, if business delegate is being used, it should have been used here to decouple web tier from ejb tier.



Still confused. So do you prefer using a BD instead of command pattern for a clean seperation of presentation tier and business tier ???

Hm.. This thread seems to throw some light to this issue :- http://archives.java.sun.com/cgi-bin/wa?A2=ind0207&L=j2eepatterns-interest&F=&S=&P=23347

According to it, the commands are used to sheild the Facade from becoming a massive one. But if you guys look at the petstore eg, they are doing all the lookups for diff EJBs inside the EJBAction(check the OrderEJBAction), and what about the exception handling, which could have otherwise done on the BD to wrap the system exceptions to app specific exceptions ???

And also, is it wise to implement this pattern for the SCEA-2 assignment ???

[ May 25, 2005: Message edited by: Giju George ]
[ May 25, 2005: Message edited by: Giju George ]
Poop goes in a willow feeder. Wipe with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1621 times.
Similar Threads
External JMS System access
Enthuware doubt : Buisness Delegate
how can i implement mvc structure in ejb layer
[mock][J2EE pattern][Business Delegate]
Business delegate pattern
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 07:05:56.