• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mediator View VS. Service to worker

 
Neha Sharma
Ranch Hand
Posts: 126
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can anybody suggest me what is the major pluses and minuses of mediator view and service to worker kind of architecture. Though I know the difference architecturily, that in the mediator view the request is dispatched to the JSP and then the JSPs do the business logic by interacting with Java beans or EJBs, while in service to worker kind of architecture the servlets does the business processing and JSPs are used for presentation. Mine is a small project with 8-10 JSPs. I'm pushing hard for the mediator view architecture but one of the guys in the team wants it to be done using service to workers. Suggestions please.
Thanks
Neha
 
Vlad Patryshev
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both ways sound not quite right to me. Why not place all the logic in the beans? My opinion is that servlets are for redirection, jsps are for presentation, and all the rest is done inside beans, is not this correct?
 
Manjunath Reddy
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Mediator view is good for a very small Application with not much complexity in the processing. This makes the architecture a kinda Model 2...which was used before the Model 3(MVC) arch. came into practice. Preferably the UI must have as less business as possible and totally de-coupled with the middle-tier for a scalable app. Morover its not good practice to access EJB's in the JSP. Instead ppl generally use DataViewObjects(clones of EJB) to ferry the data betweeen JSP and EJB's.
Seperation of various layers is accomplished with Service to worker architecture. This serves well for both small as well as large sites. Easier to maintain and lot more scalable than the 2-tier architecture. There's a lot of documentation on this @ sun site.
Just to add my 2 cents of experience...i had pretty bad experience over maintainance and enhancements with the Moderator View whereas the Service to Worker(MVC and Struts frameworks) worked well for me.
We actually evolved the controller to be a JSP instead of Servlet(thereby minimizing the compilation and deployment of the controller). This is a kind of hybrid of both the arch. that you have mentioned.
Good luck,
mpr
 
Neha Sharma
Ranch Hand
Posts: 126
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replys, but a M. Reddy in the mediator view model also everything is being written in bean just the difference is instead of the JSP calling the bean the servlet calls the bean(as in service to worker model). So my idea was to take away the complexity of writing all the logic in one servlet and write just the forwarding logic in the servlet and the bean calling logic in JSP. But as you said you done it and that's not good. Your idea about using a JSP for controller is great.
Thanks
Neha
 
Manjunath Reddy
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>>So my idea was to take away the complexity of writing all the logic in one servlet and write just the forwarding logic in the servlet and the bean calling logic in JSP.
One can further design the controller[servlet/jsp] to be divided into discrete pieces that support a specific functionality. Something akin to loginController, userController, sessionController...etc
chz,
mpr
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic