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
RubyConf 2016 - Metaprogramming? Not good enough! by Justin Weiss If you know how to metaprogram in Ruby, you can create methods and objects on the fly, build Domain Specific Languages, or just save yourself a lot of typing. But can you change how methods are dispatched? Can you decide that the normal inheritance rules don't apply to some object? In order to change those core parts of the language, there can't be much difference between how a language is implemented and how it's used. In this talk, you'll make that difference smaller, building a totally extensible object model on top of Ruby, using less than a dozen new classes and methods.
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 talk from RubyConf 2016, Justin Weiss explores the depths of metaprogramming in Ruby and the possibility of altering fundamental language behaviors beyond the conventional metaprogramming techniques. ### Main Topic The session centers on how Ruby's metaprogramming capabilities can be expanded to create a more flexible object model, enabling developers to redefine core language functionalities. ### Key Points - **The Power and Joy of Ruby:** Weiss opens the presentation by sharing his long-time affinity for Ruby, highlighting its ability to boost programmer happiness and productivity through its intuitive design and metaprogramming features. - **Beyond Basic Metaprogramming:** He challenges attendees to consider how to modify fundamental aspects of Ruby, such as method dispatch and inheritance rules, using metaprogramming strategies. - **Building a Flexible Object Model:** The talk delves into creating a new object model in Ruby, focusing on a few core methods like `add_method`, `lookup`, `build_object`, `delegate`, and `send`. - **State vs. Behavior:** A key concept discussed is the difference between state (unique to each object) and behavior (shared among objects), emphasizing the significance of understanding these differences in the context of object-oriented design. - **Method Lookup Dynamics:** Weiss discusses how method lookup can be redefined and made flexible by allowing developers to create their own logic to identify which method to invoke in various scenarios. - **Interception of Method Calls:** He introduces the concept of using interceptors to log method calls and handle errors like retrying failed methods, showcasing the model's potential flexibility. - **Multiple Inheritance:** The talk concludes with an example of how to implement multiple inheritance in Ruby, demonstrating the versatility of the newly created object model and how it allows for diverse class structures. ### Significant Examples - Weiss presents a series of coding demonstrations to illustrate how new classes and methods are defined, enabling the flexibility of method calls and behavior manipulation. These examples include creating a `Greeter` class and redefining how methods are called and logged. ### Conclusions and Takeaways - **Experimentation Encouraged:** The key takeaway is the importance of experimenting with metaprogramming techniques to deepen understanding of programming languages. Weiss promotes building and breaking conventions to discover new ways of coding. - **Understanding Language Architecture:** By exploring these advanced concepts in Ruby, developers gain insights that can enhance their programming practices across different languages. Through this exploration, they are encouraged to be creative and flexible in their programming approach.
Suggest modifications
Cancel