Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Off the Rails: Patterns for fixing fat models, ...
Search
Alexander Clark
April 23, 2019
Technology
0
340
Off the Rails: Patterns for fixing fat models, out-of-controllers, and other Rails problems
Alexander Clark
April 23, 2019
Tweet
Share
More Decks by Alexander Clark
See All by Alexander Clark
Docker: What It Is and Why You Should Care
alexanderclark
0
360
Building with Rack
alexanderclark
2
350
Other Decks in Technology
See All in Technology
AWS運用を効率化する!AWS Organizationsを軸にした一元管理の実践/nikkei-tech-talk-202512
nikkei_engineer_recruiting
0
160
Lookerで実現するセキュアな外部データ提供
zozotech
PRO
0
190
障害対応訓練、その前に
coconala_engineer
0
170
シニアソフトウェアエンジニアになるためには
kworkdev
PRO
3
250
事業の財務責任に向き合うリクルートデータプラットフォームのFinOps
recruitengineers
PRO
2
180
202512_AIoT.pdf
iotcomjpadmin
0
130
1人1サービス開発しているチームでのClaudeCodeの使い方
noayaoshiro
2
560
AWSの新機能をフル活用した「re:Inventエージェント」開発秘話
minorun365
2
370
Oracle Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
1
740
なぜ あなたはそんなに re:Invent に行くのか?
miu_crescent
PRO
0
130
ペアーズにおけるAIエージェント 基盤とText to SQLツールの紹介
hisamouna
2
1.4k
JEDAI認定プログラム JEDAI Order 2026 エントリーのご案内 / JEDAI Order 2026 Entry
databricksjapan
0
160
Featured
See All Featured
Fireside Chat
paigeccino
41
3.8k
Designing Powerful Visuals for Engaging Learning
tmiket
0
180
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Odyssey Design
rkendrick25
PRO
0
430
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
120
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
340
Statistics for Hackers
jakevdp
799
230k
A better future with KSS
kneath
240
18k
Speed Design
sergeychernyshev
33
1.4k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
150
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
1k
Transcript
Off the Rails Patterns for fixing fat models, out-of-controllers, and
other Rails problems
What I’m about to tell you is wrong.
YMMV
MVC
View Controller Model
3 Tier Architecture
Business Logic Presentation Data
Business Logic Presentation Data
Business Logic Presentation Data View Controller Model
Business Logic Presentation Data View Controller Model
View Controller Model Business Logic Presentation Data
None
None
None
View Controller Model
Model Service View Controller
Business Logic Presentation Data
Business Logic Presentation Data
Business Logic Presentation Data Service
None
None
Controller Rule of Thumb A Controller May Contain: • Public
REST methods • Private before_action setters • Private strong params method
Models
Business Logic Presentation Data View Controller Model
Business Logic Presentation Data View Controller Model
Business Logic Presentation Data View Controller Model Repository
None
Business Logic Presentation Data View Controller Validator Model
None
None
None
None
–Sandi Metz “duplication is far cheaper than the wrong abstraction”
YAGNI
Bonus Tip
None
None
Thanks for Listening Alexander Clark atheclark alexander-clark.com alexander-clark
Further reading • https://codeclimate.com/blog/7-ways-to-decompose-fat- activerecord-models/ • Patterns of Enterprise Application
Architecture (Fowler) • Domain Driven Design (Evans) • All the Little Things (Metz) https://www.youtube.com/ watch?v=8bZh5LMaSmE • Ruby Object Mapper https://rom-rb.org/
Questions?