Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Why is nobody using Refinements? by James Adam Refinements have been a feature in Ruby for several years now, added as a more structured alternative to the "scourge" of monkey patching, but it seems like almost nobody is using them. My question is this: why not? Are they a bad idea? Are they broken? Or do we just not understand them? Let's figure out once and for all what refinements are good for, and what their limitations might be, so that future generations can either use them for glory, or rightfully ignore them forevermore. Help us caption & translate this video! http://amara.org/v/H1VV/
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 "Why Is Nobody Using Refinements?" given by James Adam at RubyConf 2015, the speaker explores the underutilization of the Ruby refinements feature, which was introduced as a way to mitigate the problems associated with monkey patching. Key points covered include: - **Understanding Refinements**: Refinements allow controlled modifications to the behavior of objects by adding or redefining methods without affecting the global scope or other parts of the software. They are defined in modules using the 'refine' method, and activated within a lexical scope via the 'using' method. - **Lexical Scope**: The behavior of refinements is highly influenced by lexical scope, which determines where and how refinements are activated and available. A thorough understanding of lexical scope is critical to using refinements effectively. The speaker discusses how different scopes can lead to unexpected behavior, illustrating that methods retain the lexical scope present at their definition time. - **Examples of Refinement Use Cases**: Adam discusses various scenarios where refinements can be advantageous. These include: - Avoiding the dangers of monkey patching - Preserving original API behaviors amidst library updates - Enhancing Domain-Specific Languages (DSLs) without side effects - Implementing design patterns to confine method usage to specific parts of the codebase. - **Challenges and Controversies**: Despite their potential, refinements are not widely adopted due to misconceptions about their performance, usability, and the necessity of explicitly activating them in every file. Adam highlights the misconceptions surrounding their comparative slowness and warns against the simplistic categorization of refinements as 'bad'. - **Community Perspectives**: The speaker concludes by noting the importance of questioning established beliefs within the Ruby community regarding refinements, emphasizing that exploring the languageās features critically can lead to greater understanding and potential improvements in software development practices. This exploration reveals the complexities of using refinements and highlights an ongoing need for Ruby developers to engage with these features more deeply, thus expanding their toolkit and considerations in coding.
Suggest modifications
Cancel