Very interesting talk on Rails apps architecture by Uncle Bob.
Ruby Midwest 2011 – Keynote: Architecture the Lost Years by Robert Martin
Here’s the short summary:
“The MVC is not your applcation architecture. It’s just a tiny part of it. The real Application should have it’s own architecture(built in with the best OOP practices and patterns), and interact with your I/O(controllers) and data storage(models) via limited API.
The real Application should be in Interactors & Entities(or similar structure). It should be in the Service Layer.
Controller => Interactor => Entity => Model
Controller shouldn’t speak to the Model directly. And Model shouldn’t speak to other Models. And all the dependencies should go only one way, but not the other.”
Well, this totally ruins the Rails Way, and not really applicable directly. But that’s a good start and occasion to think about architecture, code organizing etc. Here’s some materials on the topic I found useful and pleasant to read:
- Practicing Ruby Issue #4.11 – “Responsibility-centric vs. data-centric design”
- Grouper – “Rails. The Missing Parts. Interactors.”
- ↑ & epic discussion on Hacker News
- InfoQ – Domain Driven Design Quickly
- Jared Carrol – Does My Rails App Need a Service Layer?
- Wikipedia – Data, Context and Interaction(DCI)
- Focused Controller gem
- Decent Exposure gem
- Ruby Rogues Parley discussion