News for hackers. Stuff that matters.
Re:Rails MVC VS Sproutcore MVC by l_frequency on Friday March 11, 2011 @03:13PM (#2314705)
The easier way to explain it is that Rails is not true MVC (true being defined by the original intention as described by Trygve Reenskaug for Smalltalk). True MVC is an architectural pattern based on the composite and observer patterns and is designed for synchronous apps. This is why Cocoa or Sproutcore are more like true MVC.

Rails is Model2, which is the web adapted version of MVC that is popular in server-side web dev.

Re:Rails MVC VS Sproutcore MVC by tzs on Friday March 11, 2011 @03:54PM (#2314855)
Sproutcore doesn't sound much like Smalltalk MVC. In "Applications Programming in Smalltalk-80(TM): How to use Model-View-Controller (MVC)" by Steve Burbeck, which describes how Smalltalk did it, it says:

   In the MVC paradigm the user input, the modeling of the
   external world, and the visual feedback to the user are
   explicitly separated and handled by three types of object,
   each specialized for its task. The view manages the graphical
   and/or textual output to the portion of the bitmapped display
   that is allocated to its application. The controller interprets
   the mouse and keyboard inputs from the user, commanding the model
   and/or the view to change as appropriate. Finally, the model
   manages the behavior and data of the application domain, responds
   to requests for information about its state (usually from the view),
   and responds to instructions to change state (usually from the controller).
http://st-www.cs.illinois.edu/users/smarch/st-docs/mvc.html

Looking at the Sproutcore diagram given in the article, it looks like that in Sproutcore input goes to the view, which then decides to pass it to the controller. In Smalltalk it sounds like input goes straight to controllers--views have no idea input happened unless a controller tells them about it.

It's not quite clear to me from the article, but it also looks like maybe the view gets what the information about what to display from the controller (which gets it from the model). In Smalltalk it sounds like the controller would tell the view that the view needs to update, and the view would talk directly to the model to get the data it needs.

Re:Rails MVC VS Sproutcore MVC by jerf on Friday March 11, 2011 @05:38PM (#2315202)
In my opinion, there is no such thing as an MVC web application, if you are really serious about the term meaning something and not just being a pretty paint color to put on your framework. MVC has nowhere for a client/server to go, and that's the sort of detail that shouldn't be glossed over.

"Something like" MVC is certainly possible, but MVC directly is pretty much confined to something without a client/server in it, or a cloud, and also is pretty tightly coupled to Object Orientation, too.

I think it's better just to go with "separation of concerns" and "don't repeat yourself", and pretty much whatever comes out of the end of a design based on those things will be better than trying to jam MVC in a priori. Maybe it'll even be MVC, if that's what fits, but MVC isn't specially good, it's just one point of a myriad of points on the good-DRY/SoC frontier.

Re:Rails MVC VS Sproutcore MVC by gmoeck on Friday March 11, 2011 @05:14PM (#2315136)
I'll grant that Sproutcore (and Cocoa for that matter) actually have a lot more in common with Fowler's Passive View (which I've usually seen implemented as a MVP rather than MVC) than the original Smalltalk MVC. But it surely has much more in common with the Smalltalk MVC than the Rails MVC. The only real difference is the composition of the pattern. The Smalltalk MVC is composed of Composite (View), Strategy (Controller) and Observer (Model), whereas the Sproutcore MVC is composed of Composite/Command (View), Mediator (Controller) and Observer (Model). They both manage state through a very similar three tier architecture.