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
370
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Off the Rails: Patterns for fixing fat models, out-of-controllers, and other Rails problems
Alexander Clark
April 23, 2019
More Decks by Alexander Clark
See All by Alexander Clark
Docker: What It Is and Why You Should Care
alexanderclark
0
400
Building with Rack
alexanderclark
2
390
Other Decks in Technology
See All in Technology
Backstageでつくるセルフサービスな社内開発基盤
kikunosuke75
1
210
KPIだけでは評価できないプロダクトが考えるべき Evalsという第二の評価系 / Beyond KPIs: Evals as a Second Evaluation Framework for Products #PdEConf
aki_iinuma
1
2.1k
スクラムで身についていた動き方を、XPで捉え直してみた
codmoninc
1
150
When Does a Local Qwen Start to Break
morshoto
0
120
Beyond the Hype: Practical AI for Your Oracle Database with MCP
thatjeffsmith
1
170
V8コントリビュート超入門
riyaamemiya
0
110
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
25k
プロダクトエンジニアに必要な「いい感じ」に作る能力 〜たくさん作れる時代に、どこまで作るかの決め方〜
jnishime_dresscode
2
860
When Token Pruning is Worse than Random: Understanding Visual Token Information in VLLMs
sansantech
PRO
0
240
多摩川(.dev)ランニング入門 / Tamagawa.dev#3
fujiwara3
3
260
Benchmarking Vector Databases: pgvector vs. LanceDB
tsho
0
110
みてねにおけるAI-DLC導入活動とAIドリブン開発の現在地/JAWS-UG AI-DLC #2
isaoshimizu
2
330
Featured
See All Featured
My Coaching Mixtape
mlcsv
0
300
KATA
mclloyd
PRO
35
15k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
510
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
Accessibility Awareness
sabderemane
1
190
Balancing Empowerment & Direction
lara
6
1.3k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
850
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
57k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
880
[RailsConf 2023] Rails as a piece of cake
palkan
59
7k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
220
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?