5 ms·
Use an ORM. Use an industry-standard ORM -- Hibernate, ActiveRecord, SQLAlchemy, whatever is the done thing in your language. There's just no reason not to. O
by generalk 8y ago
Use an ORM.
Use an industry-standard ORM -- Hibernate, ActiveRecord, SQLAlchemy, whatever is the done thing in your language.
There's just no reason not to. Onboarding new developers becomes easier. Your common queries (fetch a record by PK, fetch some associated records by their FK, etc) require little to no thought, and complex joins between multiple tables become relatively simple to represent. I don't know of a single ORM that doesn't also allow you to execute raw SQL and get back objects, so in the case where you really _do_ need to do that, you can.
Yes, there exist counterexamples where you're doing very cutting-edge stuff with your DB that most ORMs can't handle. If you're doing that you aren't asking "should I use an ORM," you've already made that call and skipped this thread.
- zie 8y agoI don't understand how you think using an ORM == easier onboarding, because then they have to also know the ORM. With straight SQL you just have to know SQL, which anyone messing with databases should learn anyway and is a way more portable skill than $ORM. That said, I do agree if you are going to use an ORM, definitely use an industry-standard one for your language.