Writing Small Code
summary
Builds a small Ruby command‑line option parser that starts with booleans then adds strings integers and arrays, keeping TDD and specs green the whole time. Uses concrete refactorings — extract method and extract class — plus dynamic instantiation by naming convention and dependency inversion so CommandLineOptions becomes a thin coordinator. Shows numbers: one class shrinks from ~31 lines to a 28‑line coordinator while option subclasses handle the complexity, and the resulting design works and extends without changing the coordinator.
AI-written summary · about
chapters (10)
- 0:00Start
- 6:07The Goal
- 6:28Extract Method Refactoring
- 6:49Command Line Option Parser
- 11:44First Rule of Method of Methods
- 14:24Extract Method Refactor
- 16:24Magic Constants
- 20:15How Do We Write Small Classes
- 23:32Conditional Statements
- 27:23Dependency Inversion








