Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
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 (finally?) understand why Enumerator is important and unveil the "magic" of how it works. After learning how to get started with Enumerator, we'll build up to some diverse use cases, including web crawlers and recurring events. We'll jump from crazy ideas, like emulating lazy sequences more common in functional programming languages, to sane takeaways for more common problems. Even if you've been programming Ruby for years, you may see something new or, at least, see a familiar problem with a fresh perspective. Every if you don't adopt Enumerator into your daily work, you'll come away with a deeper understanding of its advantages and how it complements its famous relative.
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 presentation titled "Enumerator's Ugly Cousin" by Ross Kaffenberger at the Ancient City Ruby 2016 conference, the speaker discusses the often-overlooked Ruby class, Enumerator, contrasting it with the widely cherished Enumerable module. The main objective is to demystify Enumerator, showing its importance and utility in Ruby programming. The talk delves into the perceptions Rubyists have of Enumerator, highlighting that many find it confusing and less elegant compared to Enumerable. Kaffenberger challenges this view by discussing several key concepts: - **Definition and Functionality**: Enumerator is described as a class that allows both internal and external iteration. The speaker illustrates how one can create an Enumerator by calling the `to_enum` method on Ruby objects. - **Comparison with Other Languages**: The speaker draws parallels between Enumerator in Ruby and Iterators in Java, as well as Generators in Python and JavaScript, explaining how these concepts relate to each other. - **Practical Use Cases**: Kaffenberger provides practical examples of how Enumerator can be utilized, such as alternating row colors in HTML tables using the `cycle` method or creating APIs that handle pagination. - **Infinite Sequences and Flexibility**: He discusses how Enumerator can be employed to create infinite sequences, offering a powerful alternative to traditional looping structures. - **Real-world Application**: A case study on his library, Montrose, demonstrates using Enumerator to model recurring events. This example illustrates Enumerator's flexibility and effectiveness in complex problem-solving scenarios. - **Learning Journey**: Kaffenberger shares insights into his personal journey with Ruby, emphasizing the importance of exploring unconventional ideas rather than adhering strictly to conventions. He encourages programmers to maintain curiosity and recognize the beauty in concepts that initially seem 'ugly'. In conclusion, Ross Kaffenberger advocates for a broader understanding of Enumerator in Ruby, challenging developers to embrace its utility and intricacies, thus enriching their programming practices. The takeaway is that while Enumerator may seem overlooked or complex, it offers significant advantages and enhances one’s approach to Ruby programming.
Suggest modifications
Cancel