Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
It's easy for models to grow unwieldy, accumulating methods, attributes, and responsibilities. But views can be even worse. Let's refactor the mess into clean, cohesive components with ViewComponent.
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 "Refactoring Volatile Views into Cohesive Components," Jeremy Smith discusses the complexities and volatility within the view layer of web development, particularly in Ruby on Rails. He highlights that the view layer, often seen as simpler than the back-end, has grown increasingly complicated due to factors like accumulation, variation, and proliferation of UI elements. Jeremy emphasizes the challenges developers face due to frequent changes, insufficient test coverage, and high complexity associated with traditional views while advocating for the use of view components to enhance organization and stability. **Key points discussed:** - **Volatility in Views:** Jeremy defines volatility in the context of web views as having high complexity and high churn, where churn refers to the frequency of change in UI elements and complexity arises from accumulation, variation, and proliferation of functions within views. - **Dimensions of Complexity:** He outlines various factors contributing to view complexity such as browser compatibility, email client intricacies, multi-tenancy theming, SEO implications, execution context, and testing affordance, which can complicate the development process. - **Introduction to View Components:** Jeremy presents view components as Ruby objects with their own templates, contrasting them with traditional views that might reference multiple objects. He promotes the use of the ViewComponent library to address view layer challenges. - **Categories of View Components:** Examples are provided for utility components (like buttons and alerts), layout components (such as page structures), and model-specific components (tied to application domains), illustrating their practical implementations using Ruby classes and templates. - **Refactoring Example:** A detailed case study is presented concerning the development of a navigation bar for a CRM application. Jeremy demonstrates how initial ERB templates became complicated with changing requirements over time and how refactoring into view components helped organize the code, enabling clearer structure and flexibility. - **Comparison with Partials and Helpers:** He discusses the limitations of using traditional partials and helpers in achieving maintainable designs and advocates for the abstraction layers that view components offer, aiding in better collaboration and design clarity. **Main Takeaways:** - Monitor view complexity and recognize volatility signs to refactor efficiently into view components as needed. - Use components to simplify testing and enhance collaboration amid changing requirements. - Leverage libraries like ViewComponent to adapt development practices and promote stability within the view layer, paving the way for better user interfaces in applications.
Suggest modifications
Cancel