IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Who here subscribes to the MVC way of writing web pages?
There has been a bit of an argument about how MVC is implemented, originally on StackOverflow but the main action has occurred in other fora, such as on this blog: http://pookey.co.uk/...azy-guy-mail.html

So who here uses a framework that calls itself "Model-View-Controller"? Most of what I've seen on SO show that people struggle with where to code the concepts, mostly where to put the "application logic". A number of frameworks enforce the idea that a Model represents a database row - which means the application logic has to fit in the Controller.

Opinions? Thoughts? Flames?

Wade.
New We do.
Data manager gets the data, controller does stuff to it (or the business logic is in the objects themselves). In Spring you can abstract out business logic like form validation as well.

I think it's fairly typical in these frameworks that the logic goes in the controller.

I should add, however, that we have a lot of business logic in the "model", ie. PL/SQL. I would agree to a certain extent with the poster in that logic that applies to the consistency of the model (which in some cases could be called business logic) belongs there, and logic pertaining to application flow belongs to the controller... however, application flow can be considered "business logic" as much as model consistency.

I think people get hung up on what has to go where, when they should be spending more time asking themselves, "where is the best place for this piece of code, regardless of what label I put on it".
Regards,
-scott
Welcome to Rivendell, Mr. Anderson.
Expand Edited by malraux Dec. 11, 2008, 10:47:05 AM EST
New I do
Well, I use JBoss for the business logic and Tomcat, Struts and JSP for the presentation, so it's a messy form of MVC. When something needs to be displayed, Struts Action code will retrieve the data needed to display then return to the Struts controller with which JSP to use for display, so it's not a clean separation of Controller and View, but it's close enough. Certainly, if I was to use a different display technology, such as Velocity, the Struts controller would not care.
-----------------------------------------------------------
Matthew Greet

I'm not prejudiced. I hate everyone equally.
     Who here subscribes to the MVC way of writing web pages? - (static) - (2)
         We do. - (malraux)
         I do - (warmachine)

It goes well with the chicken.
34 ms