~/talk

Refactoring Fat Models with Patterns

Talkat LA RubyConf 2013 · 2013-02-21..02-23· [ruby, frontend-architecture]
slides:none on file

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

  1. 0:00Introduction
  2. 2:12Rails green to brown fields
  3. 4:00Active Record’s calzone code
  4. 8:39Anti-pattern: Mixins in models
  5. 10:20Value objects for domain logic
  6. 14:51Service objects for operations
  7. 19:02Form objects for complex forms
  8. 23:18Query objects for database queries
  9. 26:28View objects for presentation
  10. 29:21Policy objects for business rules
  11. 32:51Decorators for contextual behavior
  12. 36:23Refactoring versus over-engineering
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.