Ruby Video
Talks
Speakers
Events
Topics
Leaderboard
Sign in
Talks
Speakers
Events
Topics
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Most developers know enough about refactoring to write code that's pretty good. They create short methods, and classes with one responsibility. They're also familiar with a good handful of refactorings, and the code smells that motivate them. This talk is about the next level of knowledge: the things advanced developers know that let them turn good code into great. Code that's easy to read and a breeze to change. These topics will be covered solely by LIVE CODING; no slides. We'll boldly refactor right on stage, and pray the tests stay green. You might even learn some vim tricks as well as an expert user shows you his workflow. Topics include: The Open-Closed Principle The types of coupling, and their dangers Why composition is so damn great A powerful refactoring that Kent Beck refers to as "deep deep magic" How to destroy conditionals with a NullObject The beauty of the Decorator pattern Testing smells, including Mystery Guest and stubbing the system under test The stuff from the last halves of Refactoring and Clean Code that you never quite got to. Help us caption & translate this video! http://amara.org/v/FGgU/
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 "Refactoring from Good to Great," Ben Orenstein discusses advanced refactoring techniques aimed at transforming good code into great code, making it more readable and maintainable. This live coding session is part of the Aloha RubyConf 2012 event, where Orenstein emphasizes the collaborative nature of coding and encourages audience interaction. Key Points Discussed: - **Refactoring Basics**: The talk begins with a critique of common coding practices. Orenstein shares an example of a simple report code and identifies opportunities for improvement. - **Extracting Methods**: Orenstein introduces a refactoring technique known as "extract temp to query," demonstrating how to refactor a temporary variable into its own method. This enhances code clarity and reusability. - **Tell, Don’t Ask Principle**: He explains the "tell, don’t ask" principle, advocating for sending messages to objects rather than querying their internal state. This promotes better object-oriented design. - **Identifying Data Clumps**: Orenstein highlights the "data clump" code smell and suggests creating a new data structure (date range) to encapsulate related parameters, thus improving code clarity and reducing coupling. - **Coupling and Abstractions**: The importance of low coupling in software design is emphasized, with examples illustrating how reducing dependencies between components makes the code easier to change. - **Null Object Pattern**: Orenstein introduces the Null Object Pattern as a way to eliminate conditionals regarding optional attributes (such as contacts) by creating an explicit NullContact class to handle cases where a contact may not exist. - **Importance of Abstractions**: He discusses how properly using abstractions can simplify the codebase. The example of a PaymentGateway class illustrates how to encapsulate payment processor logic to avoid tightly coupling business logic with specific libraries. - **When to Refactor**: Orenstein concludes by advising that refactoring should ideally occur when changes are needed rather than as a predetermined task, promoting a responsive approach to coding. Conclusion: Ben Orenstein's talk provides valuable insights into advanced refactoring strategies that enhance code quality. By advocating principles such as low coupling, clear abstractions, and effective use of the Null Object Pattern, he equips developers with tools to create more maintainable and understandable codebases. The session underscores collaborative programming and continuous improvement in coding practices through live demonstrations and interactive discussions.
Suggest modifications
Cancel