~/talk

Refactoring for Rails - using deodorant to prevent code smells

Talkat RubyConf TH 2022 · 2022-12-09..12-10· [ruby-on-rails]
slides:none on file

Advocates running RuboCop before committing and using extract method plugin for Vim or Sublime to make refactors practical, plus lint-staged for JS. Requires green tests before any refactor; missing an else in a case once lets new enum values explode after six months. Calls out a copied User class across five apps, whale classes of 500–1,000 lines, and controller actions of 50–100 lines as concrete smells. Recommends separate refactor PRs, extract superclass/modules, value objects or Structs, and never put modules in migrations.

AI-written summary · about

  1. 0:00Refactoring and code smells
  2. 3:15Code smells and risks
  3. 7:14Sustainable refactoring rules
  4. 10:34Spaghetti code fixes
  5. 13:10Whale classes and dosing methods
  6. 15:43Complex classes simplified
  7. 17:08Unnecessary code and comments
  8. 20:25Code dependency risks
  9. 22:12Fat controllers and thin models
  10. 24:02Rails migrations and views best practices
  11. 26:09Automated refactoring with RoboCop
  12. 27:37Summary
~/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.