In Defense of Ruby Metaprogramming
summary
Argues that Ruby metaprogramming solves organizational complexity: a status system is rebuilt so a single list or an inherited hook plus ActiveSupport.constantize auto-creates creator, predicate, and to_s methods instead of duplicating case branches. Uses define_method, method_missing, instance_eval and send; testing, example tests and comments prove correctness and aid discoverability. Shows the change reduces steps to add a new status and that it works but increases cognitive and tooling costs (harder to search, higher entry bar, less IDE support) so document, test, and teach when adopting it.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 3:30What is metaprogramming
- 6:20Ruby community’s shift
- 8:27Ruby’s flexibility undervalued
- 10:55Complexity beyond computation
- 13:20Metaprogramming to reduce duplication
- 16:52Metaprogramming cost-benefit
- 17:12Convincing skeptics
- 20:27Documenting metaprogrammed code
- 23:32Summary
related talks
18mMetaprogramming: Unraveling the Magic
26mMeta-programming for Dummies
26mMeta-programming for Dummies
36mMetaprogramming? Not good enough!
34mMetaprogramming for generalists
31mSeeing Metaprogramming and Lambda Function Patterns in Ruby
33mMetaprogramming Isn't Real, It Can't Hurt You
38mMy Meta Moments
