Talks
Speakers
Events
Topics
Search
Sign in
Search
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
search talks for
⏎
Suggest modification to this talk
Title
Description
The book Metaprogramming Ruby by Paolo Perrotta changed my perspective on Ruby and led to the discovery of numerous better practices; I'd like to share some of what I've learned with the community. Mayra Navarro is from Lima, Perú. Ruby and Rails developer for the last three years. Ruby Peru community's organizer. She enjoys Zumba classes when she is not coding with her cat. (Yes, her cat solves the bugs.) https://www.wnb-rb.dev/meetups/2022/10/25
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In this presentation from the WNB.rb Meetup, Mayra Lucia Navarro shares insights gained from the book 'Metaprogramming Ruby' by Paolo Perrotta. The session explores the concept of metaprogramming in Ruby, highlighting its capabilities and potential pitfalls for developers. Navarro defines metaprogramming as 'writing code that writes code,' emphasizing the flexibility that Ruby provides compared to more rigid programming languages like Java. Key Points Discussed: - **Metaprogramming Definition:** Metaprogramming allows developers to manipulate language constructs at runtime, enabling dynamic method generation and altering existing classes and methods. - **Active Record Example:** Navarro illustrates metaprogramming through Ruby’s Active Record, showing how it reduces boilerplate code and allows seamless access to database fields without explicit definitions. - **Monkey Patching:** An explanation of monkey patching demonstrates how Ruby lets developers reopen classes and modify methods dynamically, but highlights the risks of breaking existing code if not done carefully. - **Class and Object Hierarchy:** Navarro discusses Ruby's object model, where every line of Ruby is executed within an object (self), and explores inheritance trees which show how methods are resolved. - **Dynamic Method Creation:** The presentation details the creation of methods dynamically and using `method_missing` to handle calls for undefined methods gracefully, underscoring the power and flexibility of Ruby. - **Singleton Methods:** The distinction between instance methods and singleton methods is clarified, with practical examples illustrating their usage within Ruby classes. - **Overall Philosophy:** Navarro concludes with a recommendation to keep code simple and human-readable rather than overly complex, reinforcing the community-driven aspect of Ruby programming. Takeaway: The discussion provides a deep dive into metaprogramming with practical examples, encouraging developers to leverage Ruby’s dynamic capabilities while also cautioning them about the responsibilities that come with such flexibility. Navarro’s enthusiasm for Ruby shines through, reflecting her commitment to fostering community knowledge and best practices in the Ruby ecosystem.
Suggest modifications
Cancel