The worst Ruby codes I've seen in my life
summary
Shows concrete Ruby failures: an RSpec test reveals a mask method mutates input string (credit card number changes), a Rails controller uses nested early returns and confusing success/else paths, and a DomainChecker class memoizes seven methods, creates instance of itself, parses remote JSON, depends on the view and uses a hash constructor that only reads one key — overall a tangled if/else graph. Fixes are to rewrite from scratch, separate view/validation/HTTP, replace condition trees with policies; root causes include lack of reviews and immaturity.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 1:36Masking credit cards
- 3:11Domain creation logic
- 5:26Ruby way improvements
- 7:25Confusing method names
- 10:52Domain checker class
- 25:25Problems with DomainChecker
- 28:15Fixing the DomainChecker
- 30:13Causes of bad code
- 32:33Learning from mistakes
- 34:10Closing remarks








