[1] http://www.amazon.com/Domain-Driven-Design-Tackling-Complexi...
[1] http://www.amazon.com/Domain-Driven-Design-Tackling-Complexi...
In that same vein, this may be a repeat message of a concept that is not novel, but as an experienced non-web developer who is fairly new to Rails, I learned something from reading this.
I also appreciate you pointing out what sounds like a good development resource (Domain Driven Design).
The problem is that Rails ships with a very limited set of core architectural concepts, and many inexperienced Rails developers feel like they've got to cram all of their code into a Model, View or Controller.
Once your codebase reaches a certain complexity, principles from other programming paradigms are extremely useful.
So you could cram every design pattern known to man and they would still cram everything in their controller.
API's are hard to discover and it takes time through trial and errors or being teached the way things are.
method confirm_grouper () {
MyApp::Action::ConfirmGrouper->new(leader => $self)
->run
}
and then the controller would simply do - my $result = $member->confirm_grouper;A Service Object work, could just echo hello world every 15 seconds and still be called a Service Object, while a model in your application doing the same thing can no longer be called a Model.
The problem is that people think Rails is an architecture to begin with. Rails is just a framework that uses the MVC pattern (mangled slightly to fit the realm of HTTP). In the end, MVC is nothing but a directory structure for our files. What you put in those files and directories is up to you. Uncle Bob gave a great keynote on this called Architecture: The Lost Years. Here's a link: http://www.confreaks.com/videos/759-rubymidwest2011-keynote-...
In this way, we've successfully commoditized another differentiating factor of developers so we can ship on Internet Time(tm).
For beginners, I'm not sure it would be helpful to introduce a whole load of named patterns, as it just leads to cargo-culting and overuse of patterns without understanding whether they even apply.
It was interesting to read about a different approach though - thanks for the article.
The important metric here isn't "wc -l app/models/god.rb", it's "God.public_instance_methods.length".
There is also an argument for making models smaller by splitting some of their functionality into modules too (what you're talking about), but I think that's a weaker case - better to use concerns for shared code.
[1] http://www.infoq.com/minibooks/domain-driven-design-quickly