This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Dispatcher View or Service To Worker Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Dispatcher View or Service To Worker" Watch "Dispatcher View or Service To Worker" New topic
Author

Dispatcher View or Service To Worker

Parag Doshi
Ranch Hand

Joined: Jun 29, 2004
Posts: 317
There are 2 core j2ee patterns quite identical to each other, just different in the way the responsibilities are handled. Dispatcher view's dispatcher play a limited role and leaves it to the view to handle its content (using view helpers to get data from business service etc) and in service to worker, its dispatcher may invoke a business service to determine the appropriate view to display and all the work is done upfront.

I have seen Service to Worker being used in many web application frameworks. For example, Struts uses it and I think the Sun's WAF also uses Service To Worker (correct me if i am wrong). I havent seen any examples of Dispatcher View being used in web app frameworks. Are there any examples of dispatcher views in any web app frameworks?
How do we justify the need for Service To Worker instead of Dispatcher View and vice verse?

Any comments would be appreciated..

Thanks
Parag
Tomi Tuomainen
Ranch Hand

Joined: Jun 13, 2004
Posts: 86
Parag,

I'm not the expert in this issue but it seems that Dispatcher View is just simplified version of Service To Worker. In STW Controller, Dispatcher or View can access Helper class (and EJB Service via Helper). In DV only View may access Helper.

You should probably choose the one that is suitable for your system's work flow. I'm thinking to use STW because I want to add more responsibility to Controller. It feels more natural to access database updating services from Controller than from View.

Tomi
Parag Doshi
Ranch Hand

Joined: Jun 29, 2004
Posts: 317
Originally posted by Tomi Tuomainen:
Parag,

I'm not the expert in this issue but it seems that Dispatcher View is just simplified version of Service To Worker. In STW Controller, Dispatcher or View can access Helper class (and EJB Service via Helper). In DV only View may access Helper.

You should probably choose the one that is suitable for your system's work flow. I'm thinking to use STW because I want to add more responsibility to Controller. It feels more natural to access database updating services from Controller than from View.

Tomi


Tomi,
Thanks for your insight, helped a lot Yeah, even I am leaning towards the STW as it seems to be a natural fit for accessing business services.

Another question related to this:
In a sequence diagram, if I am showing multiple requests coming from the user, do I have to always go through the following steps again and again:
User--> Controller--->Dispatcher--->ViewHelper--->BusinessDelegate-->business method etc

the above mentioned flow is common for all requests and a seq diagram might have multiple requests, one after another occuring in its life line. Do we have to show the above steps for all requests in that seq diagram?

Thanks..
parag
Roger Rustin
Greenhorn

Joined: Jul 08, 2004
Posts: 19
As I understand the main purpose of sequence diagram is to map in what sequence the operation will be performed. If a diagram is too cluttered with small details to the extent that differentiating between what is main flow and what's the supporting flow then it's time to leave some of the common details off the diagram. It would be best to draw one sequence diagram which discusses the basic/common activities occuring in each sequence and then to concentrate on main flow.

Thanks.
- Roger
Parag Doshi
Ranch Hand

Joined: Jun 29, 2004
Posts: 317
Originally posted by Roger Rustin:
As I understand the main purpose of sequence diagram is to map in what sequence the operation will be performed. If a diagram is too cluttered with small details to the extent that differentiating between what is main flow and what's the supporting flow then it's time to leave some of the common details off the diagram. It would be best to draw one sequence diagram which discusses the basic/common activities occuring in each sequence and then to concentrate on main flow.

Thanks.
- Roger


Thanks for your reply, Roger. So, would it be a good idea to have a sequence diagram which explains the flow from the web tier to the business tier showing every detail along the way and then just refer the "web tier framework" in rest of the diagram. would that be a valid way to draw it?
In other words, is that considered UML compliant? It makes a lot of sense to draw it that way, just wanted to make sure its not invalid UML syntax.

Thanks,
Parag
Tomi Tuomainen
Ranch Hand

Joined: Jun 13, 2004
Posts: 86
Parag,

In UML Spec 1.5 you might want to check chapter 3.61.3 (Object Lifeline - Presentation Options). You can put an array and a note "The flow continues in Diagram 2" in your sequence diagram.

Of course you can also make general diagrams and more detailed diagrams to specify some parts. Just remember to explain everything to your examiner .

Tomi
Parag Doshi
Ranch Hand

Joined: Jun 29, 2004
Posts: 317
Originally posted by Tomi Tuomainen:
Parag,

In UML Spec 1.5 you might want to check chapter 3.61.3 (Object Lifeline - Presentation Options). You can put an array and a note "The flow continues in Diagram 2" in your sequence diagram.

Of course you can also make general diagrams and more detailed diagrams to specify some parts. Just remember to explain everything to your examiner .

Tomi


Thanks Tomi. By the looks of it , I will have a lot of explaining to do
One way would be to cut n paste all the conversations I have had here that way th examiner will get to know the entire process of reaching a decision.

Parag
 
 
subject: Dispatcher View or Service To Worker