Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
RubyConf AU 2015: http://www.rubyconf.org.au Wikipedia, the Webster's Dictionary of our generation, defines a Use Case as "a list of steps, defining interactions between a role and a system, to achieve a goal." If you cut your teeth on RoR, at some point you've probably shuffled domain logic from views to controllers to models to POROs in pursuit of Separation of Concerns. Now it's time to introduce Use Cases as a contextual, well-defined interface between your Rails controllers and your domain entities. Walk through real examples and learn how these nifty little classes reveal your user stories while hiding implementation detail.
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 her talk titled "A Case for Use Cases" delivered at RubyConf AU 2015, Shevaun Coker argues for the implementation of use cases as a crucial design pattern to enhance the structure of Ruby on Rails applications. The session is framed as a trial, with use cases being put on trial for their ability to improve the quality and maintainability of Rails applications. Coker highlights several key issues commonly encountered in Rails development, particularly related to the separation of concerns and reduction of complexity. **Key Points Discussed:** - **Introduction to Use Cases:** Coker defines a use case as a contextual, well-defined interface between controllers and domain entities, aimed at encapsulating complex business logic. - **The Rails Development Pain Points:** She recounts a familiar scenario where business requirements evolve, leading developers to overburden controllers, models, and views, causing the infamous "fat controller" and "fat model" phenomena that make code difficult to manage. - **Consequences of Fat Models:** A detailed analysis of the drawbacks of fat models, which include excessive responsibilities and high coupling, ultimately complicating future maintenance and introducing bugs. - **Implementation of Use Cases at Envato:** Coker shares her experience in implementing the use case pattern at Envato, detailing how it provides simplicity and consistency in code. Each use case is implemented as a plain Ruby class focusing on a single action. These classes encapsulate a series of steps necessary for completing user actions, promoting better organization and readability. - **Command-Query Separation:** A critical lesson learned was the importance of separating command methods (which modify state) and query methods (which return values) to enhance testability and maintainability of code. - **Refactorings and Best Practices:** Coker emphasizes the importance of keeping use cases specific, avoiding generic designs that blur the clarity of single user actions. She also discusses the creation of specialized objects to handle low-level logic, thereby reducing the responsibility of the use case classes. - **Benefits of Use Cases:** The use case pattern leads to more readable code, better encapsulation of business logic, and greater visibility of features within the codebase. Coker concludes that the use case pattern is a powerful tool for improving the structure of Rails applications. **Conclusion:** In summary, the talk concludes with the assertion that the use case pattern has proven beneficial in reducing coupling, increasing feature visibility, and encapsulating complex business logic in Rails applications, advocating for broader adoption of this design pattern among developers.
Suggest modifications
Cancel