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
Enumerable's Ugly Cousin by Ross Kaffenberger Everyone loves Ruby's Enumerable module. What about Enumerator? Many of us don't what Enumerator is or why it's useful. It's time to change that. We'll challenge conventions and (finally?) understand why Enumerator is important while unveiling the 'magic' of how it works. Help us caption & translate this video! http://amara.org/v/PsL9/
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 titled 'Enumerable's Ugly Cousin,' Ross Kaffenberger dives into the underappreciated Ruby feature, Enumerator, contrasting it with the more celebrated Enumerable module. While Enumerable is often praised for its elegance, Kaffenberger highlights the common misconceptions surrounding Enumerator, which many find confusing or ugly. Key points include: - **Understanding Enumerator**: Kaffenberger clarifies that Enumerator is a class for both internal and external iteration, allowing enumeration of objects via the `to_enum` method. He emphasizes its role in enabling lazy enumeration, which is crucial for handling large or infinite datasets efficiently. - **The Generator Pattern**: He discusses the generator pattern as a powerful way to produce data on the fly, allowing functions to pause and resume. This contrasts with eager expressions that compute everything upfront, potentially using up unnecessary memory. - **Cross-Language Perspectives**: Kaffenberger compares the treatment of generators in different programming languages. While some communities view them with skepticism (like JavaScript's Airbnb style guide), others, especially Python enthusiasts, celebrate their potential for lazy computations. - **Real-World Example**: He shares a personal anecdote about his experience in developing a recurring events feature for a Ruby-based project. The challenges faced helped him realize the importance of using Enumerator to model events that recur indefinitely, such as the second Tuesday of every month. - **Practical Application**: Kaffenberger introduces a gem he developed called Montrose, which leverages Enumerators to manage and yield recurring events in Ruby. This encapsulates the benefits of lazy enumeration, allowing for efficient data streaming without excessive memory use. - **Conclusion**: He encourages developers to reconsider when to use eager vs. lazy methodologies, likening it to choosing between bulk shopping (Costco) and on-demand flexibility (Netflix). Kaffenberger concludes that despite initial appearances, Enumerator offers significant beauty and functionality, advocating for a shift in perspective towards embracing concepts that may seem difficult or unattractive at first glance. Through this presentation, Kaffenberger not only educates about the importance of Enumerator in Ruby but also reshapes the viewer's understanding of coding elegance and efficiency, urging them to appreciate what may initially seem like 'ugly code.'
Suggest modifications
Cancel