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
350
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
360
Other Decks in Technology
See All in Technology
バクラクのSREにおけるAgentic AIへの挑戦/Our Journey with Agentic AI
taddy_919
2
1k
DX Improvement at Scale
ntk1000
2
290
問い合わせ自動化の技術的挑戦
recruitengineers
PRO
2
150
新職業『オーケストレーター』誕生 — エージェント10体を同時に回すAgentOps
gunta
4
1.4k
男(監査)はつらいよ - Policy as CodeからAIエージェントへ
ken5scal
5
730
kintone開発のプラットフォームエンジニアの紹介
cybozuinsideout
PRO
0
820
AIに視覚を与えモバイルアプリケーション開発をより円滑に行う
lycorptech_jp
PRO
1
790
プロジェクトマネジメントをチームに宿す -ゼロからはじめるチームプロジェクトマネジメントは活動1年未満のチームの教科書です- / 20260304 Shigeki Morizane
shift_evolve
PRO
1
110
ソフトウェアアーキテクトのための意思決定術: Create Decision Readiness—The Real Skill Behind Architectural Decision
snoozer05
PRO
30
9k
クラウド時代における一時権限取得
krrrr38
1
160
20260305_【白金鉱業】分析者が地理情報を武器にするための軽量なアドホック分析環境
yucho147
1
170
Security Diaries of an Open Source IAM
ahus1
0
200
Featured
See All Featured
New Earth Scene 8
popppiees
1
1.7k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
310
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
190
Mind Mapping
helmedeiros
PRO
1
110
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
The SEO identity crisis: Don't let AI make you average
varn
0
400
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
600
Prompt Engineering for Job Search
mfonobong
0
180
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
220
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
140
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
87
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?