• Post Reply Bookmark Topic Watch Topic
  • New Topic

Business Tier + Persistence Tier  RSS feed

Julie Desuza
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to me in MVC2 architecture ��..

JSP + HTML + JSP should be View Part
Action Class + Form Bean + struts-fonfig.xml should be Controller Part
Database + Java Beans should be Model Part

Question is ���..

Model is presentation layer here. Which one is persistence tier and Business Tier in between Model and Controller.

According to me���. Model must be business tier as it encapsulates business logic and Controller must be Persistence Tier���� Kindly correct me if wrong.

Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's my opinion.

MVC is a architecture pattern that comes from smalltalk. The major point in mvc is the decoupling amont 3 pieces: controller, view, model.

In web enviroment, mvc cannot be fully (and naturally) implemented, because there's no such event that states a change in model to the view, that's why they came up with the Model 1 and Model 2 things, which are approaches to simulate mvc in a web enviroment.

People who work with web are used to think on 3 tier applications: Presentation, Business, Persistence. So it's natural to make some kind of "mapping" between mvc and 3 tier applications, something i think is not the best strategy.

In my opinion, we cannot try to make some strong rules. In other words, Business, Presentation, Persisten just don't directly match with Presentation, Model, Control, they are diferent views of an application.

MVC (Model, view=presentation, control) is a higher level abstraction of your application. So you create your business, view and persistence code under this higher level view of mvc. I might be getting confusing here, but i'm trying to make it clear.

The only thing we cannot separate is presentation and view, they are the same thing, but business doesn't map to model or control.

Usually, we implement business in a controller level, but business might also be implemented in the model level. Persistent classes, for example, represent model and we might have some simple business logic there.

So, my advise to you is:
- Presentation logic -> View (MVC): jsps, html
- Business logic -> Control (MVC) and Model(MVC): Action, session ejbs, pojos,etc..
- Persistent logic -> Model(MVC): persistent classes

Well, as i said, this is my opinion.
[ September 06, 2004: Message edited by: Leandro Melo ]
Masoud Kalali
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends
Struts is an MVC compliant framework
My openion about your question(s) is

View : is JSP + any ther page produced by template engine or other ways + HTML [generally what ever help you see/insert/delete
some information from your System. its just my openion]

Model : In MVC model is responsible for buisiniss rules and any rule round your application data
[persisting and rules over persistence . IMHO]
Struts does not provide any classes or Stuff for Model.Application would have diffrent models depend on needs
for example you may use Hibernate for preparing Model or JDO , EJB ...

Controller: controler is responsible for relating Model and view and it define the application Flow.
user Actions give Controller some arguments it need to perform some model's operation.
Diffents models need diffrents Controler , In Struts union of Actions , ActionServlet,Config Object (Struts-config.xml)
compose Controler.

Hope it helps.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!