3 ms·
> I've always said: "ORMs are for people who don't know SQL!" False. To use an ORM you must know and understand data modelling and the Entity/Relationship mode
by spriggan3 10y ago
> I've always said: "ORMs are for people who don't know SQL!"
False. To use an ORM you must know and understand data modelling and the Entity/Relationship model. I'd say, people who don't like ORMs are often those who don't understand that model.
If you do understand it, then you know that relationships can be represented 100% by code in an OO language, thus completely automated.
Why bother writing your own hydrators for each entity when you can model them directly in a library? it doesn't make a codebase more maintainable or readable.
Furthermore you could have an ORM that uses SQL directly for queries, and still eagerly resolve relationships. It's just not practical, that's why ORMs often come query builders.
That is the thing that abstracts SQL, not an ORM per say. ORMs only deal with relationships between entities. Query Builders build SQL queries.