Maintaining Balance while Reducing Duplication: Part II
summary
Argues that DRY means a single authoritative piece of knowledge, not avoiding repeated characters, and shows concrete refactorings: using extract method to avoid cross-service coupling, pulling up behavior to a superclass vs introducing a template method to avoid hidden state, and comparing ActiveRecord migrations/validations mismatches with a DataMapper-style single-definition approach; demonstrates a 15-route example and RSpec/Cucumber practices where over-DRYing harms readability and test isolation.
AI-written summary · about
chapters (17)
- 0:00Introduction to DRY
- 1:00Defining authoritative knowledge
- 2:05Active Record limitations
- 3:24Validation and ambiguity
- 5:23Migrations and structure
- 6:30Data Mapper and centralization
- 7:29Testing and RSpec
- 8:27Executable documentation
- 10:24Code smells and duplication
- 12:36Extracting methods correctly
- 14:28Refactoring and naming
- 15:55Template method patterns
- 19:23Abstraction levels
- 21:47When not to be DRY
- 25:05Balancing complexity and DRY
- 28:26Testing strategies
- 35:38Test helpers and Q&A







