4 ms·
1. Good luck finding all places that access some table if you want to change something, especially if table is called users or products. 2. ORM provide abstrac
by fiedzia 8y ago
1. Good luck finding all places that access some table if you want to change something, especially if table is called users or products.
2. ORM provide abstraction layer. Otherwise every place needs to know all details of tables it accesses. Migration from db to solr for example is much easier with ORM. Ensuring that you call strip_html or other logic in all relevant places is also easier if you have one entry point you can hook into.
3. Strings compose poorly.
Building complex queries from set of parameters sucks.
4. Database portability is crucial, even if you will never migrate. It gives you access to far greater mindshare and toolset.
- ccajas 8y agoIs this also a useful tool from an administrative point of view? One of my friends is a db admin and he has not heard of ORMs at all.
- fiedzia 8y agoProbably not. The only point of contact with an admin I can think of is that orms can manage schema migrations.
- akudha 8y agoGood luck finding all places that access some table if you want to change something Is it really that hard though? All we need to do is have a class for Users (or products or whatever) and put all queries in that class. ORMs are annoying, they add another layer of complexity and take the joy out of just writing a simple query. Now I have to learn yet another syntax which is totally unnatural. There is no guarantee these ORMs convert to optimized queries, and not all ORMs support all SQL features either. Just reading a 20 line ORM query with multiple complex joins vs the same thing written in plain SQL hurts the eyes and brain.
- fiedzia 8y ago> All we need to do is have a class for Users (or products or whatever) and put all queries in that class. Yes, and this is very close to doing what orms do.