Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Is your Rails app sluggish? Does its performance suffer? Even with the best intentions, Rails applications can become littered with anti-patterns that negatively affect developer velocity, code clarity, and maintenance. Following a few simple patterns and strategies, you can transform your Rails application code to become more robust and functional. One that will be easier to extend and maintain. This talk will explore anti-patterns in practice and suggest fixes to ensure your Rails project is a success.
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 talk 'Exploring Rails Anti-patterns' presented by Elle Meredith at RubyConf AU 2024, the focus is on identifying and rectifying common anti-patterns in Ruby on Rails applications that can lead to performance issues, reduced developer velocity, and maintenance challenges. The session highlights the importance of clean architecture and provides practical solutions through examples from a simple app involving users, their addresses, and orders. Key points discussed include: - **Definition of Anti-patterns**: Common, yet ineffective approaches to recurring problems that can clutter code and hinder performance. - **Refactoring**: Improving code without changing its external behavior and ensuring tests are in place to confirm functionality. - **Fat Controllers**: The dangers of overloading controllers with business logic and conditional statements, suggesting the use of service objects for better organization. For instance, using a service object for handling orders reduces complexity in the orders controller. - **Avoiding Non-standard Actions**: Emphasizing the importance of RESTful routes and architecture in controller design. An example is restructuring a controller to separate password-reset functionality into its own controller for clarity. - **SQL Query Optimization**: Advocating for the use of Active Record queries to simplify and reduce SQL complexity via eager loading methods, and monitoring n+1 query issues with tools like the Bullet gem. - **Managing Relationships**: Discussing the principle of low coupling by using delegation or presenter classes to manage object interactions, thus minimizing nil errors and preventing deep associations from complicating code. - **View Logic Management**: Recommendations to keep views clean by outsourcing logic to helpers or decorators, avoiding logic-heavy views that violate the DRY principle. - **Model Responsibility**: Encouraging the separation of model responsibilities to avoid God objects or fat models, suggesting that service objects encapsulate specific functionalities for better maintainability. The talk concludes with a strong emphasis on maintaining a clear architecture through vigilance against anti-patterns in Rails applications. By adhering to good design principles and ensuring business logic resides in appropriate locations, developers can enhance both performance and maintainability of their Rails codebases.
Suggest modifications
Cancel