[Catalyst] Shoot out -- Catalyst / RoR / Other MVC apps --

Matt S Trout dbix-class at trout.me.uk
Tue May 8 16:17:18 GMT 2007


On Tue, May 08, 2007 at 03:24:15PM +0100, Luis Azevedo wrote:
> On Tuesday 08 May 2007, mreece at vinq.com wrote:
> >  > On Tue, May 08, 2007 at 09:28:35AM +0100, Anthony Gardner wrote:
> >  >> I seem to remember hearing sth a few months ago about a comp between
> >  >> various MVC apps comprising of various teams / tasks / time limits etc.
> >  >>
> >  >> Does anyone know what I'm talking about here?!
> >  >
> >  > If it was MVC, why would rails be included?
> >
> >  what distinction are you making here to exclude rails from MVC?
> 
> Somehow, Matt looks like to have some love/hate relationship with rails :P.

I agree with them on some things and find other design decisions laughable.
 
> What I still not understand is why he says RoR isn't MVC O:). 

Because their "models" are dumb data objects and they shove all the business
logic into what they call the controller.

>From the article that originally defined MVC -

"Models -- The model of an application is the domain-specific software simulation or implementation of the application's central structure."

"Views -- In this metaphor, views deal with everything graphical: they request data from their model and display the data."

"Controllers -- Controllers contain the interface between their associated models and views and the input devices (e.g., keyboard, pointing device, time)."

i.e. the controller should handle receiving user input and processing it
appropriately - the domain logic should reside in the model.

This is bloody important for building good application architecture - a cron
script or e-mail gateway should be able to invoke e.g. a create user function
in the model without ever having to load the web-related code. If your
create user logic is in the controller, you're stuck with either talking to the
app over HTTP or simulating a request.

The controller's there for event dispatch and flow handling. Domain logic
should be encapsulated - if anything, you want to make your domain model a
completely separate piece of code with an interface model (or Facade Model)
that your application interacts with.

All rails really does is separate out the logic and the presentation - which
you could do just as easily with a PHP page or CGI that invokes a templating
engine to render the HTML. It's better than having everything in one file, but
it damn well isn't MVC.

-- 
     Matt S Trout        Need help with your Catalyst or DBIx::Class project?
  Technical Director     Want a managed development or deployment platform?
Shadowcat Systems Ltd.   Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Catalyst mailing list