|
|
|
|
|
by amarraja
2920 days ago
|
|
They are useful if you only use them for simple things. Any queries which are non-trivial or aren't cleanly expressed in your object model can lead to absolutely monstrous queries. I once saw a 1000 line query - which unsurprisingly timed out - generated for getting a single user record from the database! There were several lookups to rate limit failed login attempts etc, however this should be a couple of lines of efficient sql if hand rolled. I can tolerate something like Rails' ActiveRecord if used with restraint. E.g. user.addresses << Address.new(blah)
Is very useful, it doesn't get in the way and does all the boring stuff for me. People just need to learn this isn't the only way to access the database, and you can drop to sql if you need to.Fortunately I started developing at a time where there were no ORMs, but I fear there is a new generation of devs who see SQL as some esoteric ASM for databases. Also, I disagree with database portability as an argument for ORMs. All abstractions are leaky, and trying to unify everything will stop you taking full advantage of your data-store of choice |
|