📎 Webclip
Why ActiveRecord Sucks - Very Good Indicators
The post argues that ActiveRecord makes common tasks easy, but that ease hides costs in memory use, coupling, SQL quality, and readability. It also connects this preference for ease with a broader habit of chasing convenience without considering the tradeoffs.
Reading notes#
- ActiveRecord does a lot of work behind the scenes, which can increase memory use when many instances are created.
- It can make classes depend on Rails and on specific object APIs, which increases coupling and makes tests rely on loading Rails.
- For simple queries it works fine, but complex queries can become worse SQL than an experienced engineer would write directly.
- When queries become intricate, ActiveRecord code can turn into many method calls and SQL fragments that are harder to read than plain SQL.
- The author likes ActiveRecord, but says its convenience should be weighed against performance and complexity costs.
