Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
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
フロントエンド開発者のための「厄払い」
optim
0
180
システムのアラート調査をサポートするAI Agentの紹介/Introduction to an AI Agent for System Alert Investigation
taddy_919
0
790
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
13k
メルカリのAI活用を支えるAIセキュリティ
s3h
7
5.4k
IaaS/SaaS管理における SREの実践 - SRE Kaigi 2026
bbqallstars
0
350
Deno・Bunの標準機能やElysiaJSを使ったWebSocketサーバー実装 / ラーメン屋を貸し切ってLT会! IoTLT 2026新年会
you
PRO
0
130
Digitization部 紹介資料
sansan33
PRO
1
6.7k
エンジニアとマネジメントの距離/Engineering and Management
ikuodanaka
3
680
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1k
人はいかにして 確率的な挙動を 受け入れていくのか
vaaaaanquish
5
3.2k
ZOZOにおけるAI活用の現在 ~開発組織全体での取り組みと試行錯誤~
zozotech
PRO
2
1.5k
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
2.9k
Featured
See All Featured
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
50
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
Producing Creativity
orderedlist
PRO
348
40k
Color Theory Basics | Prateek | Gurzu
gurzu
0
190
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Everyday Curiosity
cassininazir
0
120
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
2.9k
Navigating Team Friction
lara
192
16k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.1k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
130
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
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?