DEV Community

Discussion on: Git security mistakes; addressing tech debt; & writing fast code in Ruby on Rails

Collapse
andrewbrown profile image
Andrew Brown 🇨🇦

⭐⭐⭐⭐⭐

Dependencies

The number one thing the hurts my ears when people say "There's a gem for that". If you haven't maintained an app for 5+ years then you may not know the pains of having too many dependencies or how things you never would think to break or would become serious obstacles down the road.

Objects

I honestly never think in Big O terms but it's easy to fix bottlenecks when you know the number of objects ActiveRecord makes. So I use raw queries and not use ActiveRecord models for reads in most cases.

Collapse
mohanarpit profile image
Arpit Mohan Author • Edited on

While I agree with some of the inefficiencies caused by ORMs like ActiveRecord, I think they have a place in this world. Most ORMs get a bad rap from people misusing them (because it's so easy to use) and not bothering to understand the underlying queries being made by the ORM.

Although, executing raw queries is great because you have a lot of control, you would lose out on syntactical sugar and ease of programming. It's a trade-off but I'd still use an ORM and try to optimize it's usage unless I need to eke out a LOT of performance from the webapp.

Collapse
andrewbrown profile image
Andrew Brown 🇨🇦

True, except I wrote my own gem called monster-queries which gives you syntactical sugar and ease of programming for writing raw queries. 😉