4 ms·
Rails didn't bastardize MVC, users of Rails bastardized MVC. Over the years we've seen the progressions of fat controllers to skinny controllers and fat models.
by rubiquity 13y ago
Rails didn't bastardize MVC, users of Rails bastardized MVC. Over the years we've seen the progressions of fat controllers to skinny controllers and fat models. Now, we're seeing the progression of using models only for responsibilities related to persisting the object. This leads to extracting additional domain logic into Presenters, Value, Service objects, etc.
Avdi Grimm has a great book about this called Objects on Rails[1] and Bryan Helmkamp from Code Climate has a good introductory blog post on it as well[2].
Rails implementation of MVC is perfectly fine. It's when people lean on MVC for everything without applying "classic" Object-Oriented design. That's when things become a mess.
1 - http://objectsonrails.com/ http://objectsonrails.com/
2 - http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decompose-fat-activerecord-models/ http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decomp...
- pothibo 13y agoThe decomposition of ActiveRecord Object is not bad. I don't like class like UserAuthentication and AbandonedTrialQuery. I would rather have something like. #app/models/user/query.rb class User module Scopes #my scopes. end end
- rubiquity 13y agoEveryone has their own preference for implementing object oriented design which will help push things forward. The important part is that people are thinking about object oriented design more than ever before.
- pyrocat 13y agoAs an aside on terminology, why do we use the terms "skinny" and "fat"? Shouldn't it be "short" and "tall" since code is represented vertically?
- roryokane 13y agoI imagine the words as analogies to people and their ease of movement. Fat (“bloated”) components are hard to work with and develop, in the same way a fat person has trouble running from point to point. On the other hand, skinny components are easy to work with because there is little to comprehend, the same way that skinny (“lean”) people will run more quickly and easily.
- steveklabnik 13y agoBecause that's the title of this blog post: http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat... The only times 'fat' and 'skinny' are mentioned in the title.
- zalew 13y agobecause fatness is ammount of business logic, not ammount of lines of code. a model with 150 data fields can be a skinny model.
- jerf 13y agoAll programming language terminology gets blurrier the wider the usage of the term becomes. Right now, if you keep your eye out, you can see this is happening to the term "coroutine"; it's currently mutating from it's programming language research meaning [1] to something indistinguishable from "lightweight thread", or indeed possibly even indistinguishable from "thread". "MVC" as a meaningful term has been dead for at least 5 years. [1]: http://en.wikipedia.org/wiki/Coroutine http://en.wikipedia.org/wiki/Coroutine
- asdasf 13y agoRails started out as a "the database is stupid, it is just storage" and "models are just object wrappers over your stupid database" as defining characteristics. And it has always had this weird notion that everything has to go through controllers. So it certainly did bastardize MVC, and the guy who came up with MVC has even pointed this out (not specifically about rails I don't think, but about the plethora of faux-MVC frameworks that exist now).