Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
RubyKaigi2017 http://rubykaigi.org/2017/presentations/shioyama.html Did you know that Ruby has configurable modules? One of the most interesting features of Ruby, the Module Builder Pattern is also probably its least well-known. Simply subclass the Module class, dynamically define some methods in an initializer, and boom, you can create named, customizable modules to include in other classes. In this talk, I'll explain how I've leveraged this unique feature of Ruby to build a translation gem called Mobility that can handle a wide range of different storage strategies through a single, uniform interface.
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 the talk titled "The Ruby Module Builder Pattern," Chris Salzberg explores the intricacies of Ruby modules, particularly focusing on the concept of module builders. The presentation begins with an introduction to modules in general, defining them as self-contained components with well-defined interfaces. Chris draws parallels between Ruby modules and modular designs in architecture and technology to emphasize their properties, such as standardization and customization. Key points discussed include: - **Understanding Modules**: Modules are key components in Ruby for achieving modularity. They can be included in classes, used for namespacing, and provide callbacks for inheritance. - **Flexibility in Design**: The limitations of traditional modules lead to the necessity for module builders that can pass configurations dynamically. - **Metaprogramming**: Chris emphasizes the role of metaprogramming in configuring module functionality, although it can introduce complexity. - **Module Builder Concept**: A pivotal aspect of the talk highlights module builders, which allow the definition of modules as subclasses where methods can be defined in an initializer, enhancing flexibility and clarity in code. - **Practical Example**: Using the 'edible' module, Chris illustrates how traditional modules limit flexibility and how a more dynamic approach with a method called ‘define_adder’ can enhance this design. - **Anonymous Modules**: The use of anonymous modules provides a way to keep functionality distinct while also managing method definitions clearly, promoting better organization. - **Real-World Applications**: The concept of module builders is applied within the context of the Mobility gem, showing how translation strategies can be abstracted while allowing for diverse storage backends. Chris concludes that the implementation of module builders leads to improved maintainability and clarity in Ruby projects. He encourages attendees to explore these design patterns for enhanced modular programming. The talk fosters engaging discussions on metaprogramming and its complications while celebrating modular design principles in Ruby.
Suggest modifications
Cancel