Refactoring Fat Models with Patterns
summary
Video gives concrete refactor recipes: extract value objects, service objects, form/query/view/policy/decorator objects from bloated ActiveRecord classes. It demonstrates seven patterns (plus an anti-pattern of mixin junk drawers), shows Code Climate examples and uses tools like bcrypt, secure_compare, Virtus/composed_of and mentions Draper; cites the common symptom of a User class ballooning past 500 lines. Code samples build standalone objects (e.g. token and password authenticators, signup form, import query, order notifier) and claim to reduce callback hell and make behavior opt‑in.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 2:12Rails green to brown fields
- 4:00Active Record’s calzone code
- 8:39Anti-pattern: Mixins in models
- 10:20Value objects for domain logic
- 14:51Service objects for operations
- 19:02Form objects for complex forms
- 23:18Query objects for database queries
- 26:28View objects for presentation
- 29:21Policy objects for business rules
- 32:51Decorators for contextual behavior
- 36:23Refactoring versus over-engineering








