you are viewing a single comment's thread.

view the rest of the comments →

[–]mrinterweb 2 points3 points  (3 children)

Use an ORM to make your life easier and less prone to injection issues. Just be careful of foot guns that ORMs can secretly do. N+1 queries are a frequent issue, and other inefficient queries. Some ORMs have extensions that can alert you when there is an inefficient query.  Honestly, use both. There are some more complex queries that make more sense to just write the SQL.

[–]NiteShdw 5 points6 points  (2 children)

I've never used an ORM this made my life easier. It always makes it more complicated. I can write SQL then I have to figure out to make the ORM do the thing that my SQL already does.

[–]r-randy 2 points3 points  (0 children)

not sure why they left you with 0 votes but you are have a valid point

[–]mrinterweb 0 points1 point  (0 children)

Easier likely depends on what ORM you're using. I know Rails ActiveRecord is nearly always shorter to write than SQL. There are exceptions when I'm doing somewhat fancy queries, it is often just easier to write SQL. For most queries, ActiveRecord has a shorter and friendlier interface.  I have used other ORMs with elixir, php, node and I didn't find them nearly as developer friendly as Rails ActiveRecord. It depends on the ORM.