Phlip wrote:
Justin Forder wrote:
Hmm. Given the constraints of working with HTTP, is Rails any less MVC
than J2EE Model 2 MVC? That pattern is what is commonly referred to as
'MVC' in web application development.
That system is why I went to the ModelViewController page on a certain
Wiki and added 'When a system obeys the principle
DoTheMostComplexThingThatCouldPossiblyWork, marketects often respond
by clumping its rambling notions together into 3 groups. The
sub-SpaghettiCode group nearest the User becomes the "view", that
nearest the database becomes the "model", and the stuff in between
becomes the "controller".'
To answer your question, the browser layer ain't the View. The View is
"That which observes the Model", which is typically in our controller
layer.
That does nothing to answer my question, and jumps to a wrong conclusion about what I thought the View was, but at least it tells us what one of your layers is.
The part of Rails that *presents* the Model is the View.
Model 2 MVC is a server-side MVC model constrained by the grain size of the HTTP request/response, dividing responsibilities as follows:
- the controller interprets the HTTP request, makes any changes required on the model, and decides what view should be presented next;
- the view renders the required parts of the model, together with user controls, to provide the body of the HTTP response;
- the model is an appropriate OO model of the application domain.
This is a perfectly valid interpretation of MVC, given the constraints, and has been the dominant OO web architecture over the past five years. Competition from component-oriented MVC web architectures (JSF, Tapestry, WebObjects...) is growing, and continuation-based approaches are worth keeping an eye on.
You concentrated on the "observing" relationship between the view and model which is an important part of classical MVC. That works well Smalltalk (and in 'fat' applications in general), where the view can be updated incrementally, but is less relevant when you are using HTTP with a stateless server. Then you have to create the whole rendered result on each request.
regards
Justin Forder