Metaprogramming in the Wild: Source-Diving FactoryGirl 3.91


Metaprogramming is still an elusive practice of Ruby programmers; Rails 3 helped bring it more into the spotlight but the dynamicism turned a lot of developers off.

FactoryGirl uses metaprogramming heavily in order to support concepts of mixins (for shared traits), inheritance (for parent/child factories), and lazy evaluation (for attributes that refer to each other). In this talk, I cover the various ways to use metaprogramming to help build a good DSL by covering context evaluation, defining methods dynamically, method scoping, and design principles like SRP and OCP to add and extend behavior easily.

comments powered by Disqus

4 Ratings: 3.91

Delivery: 4.25

Content: 3.58