Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

With all due respect, I feel like this is a vacuous statement. While there is no doubt overhead, I think the network latency of DB connections far outweighs a well-written ORM. What may be happening is an overreliance on ORMs in the sense of using them as a hammer and all functionality is a nail – generating thousands of instances of an ORM vs. one collection containing multiple records O(1) vs O(~n). This is no longer ORMs, but just bad practice in general.

In my experience with Laravel, the Eloquent ORM and the Fluent query builder both generate semi-optimal SQL for the majority of cases I've experienced them for, and they're easy to debug and see what's happening. Profiling tools like Debugbar let you see how many instantiations, objects, queries, and Models your page has, none of which you'd have if you skipped the ORM. These are critical to writing sensible code and also having a deeper understanding of how your application works when you utilize abstractions. But they also save you enormous amounts of time. I doubt writing it all by hand would be better or faster except by an expert-level programmer with deep DB knowledge.

I don't begrudge the value of knowing what's happening behind the scenes – in fact, I'm saying these tools can help open up understanding what's happening. I learned more about subqueries by seeing the SQL generated by the query builder, as well as how to write them efficiently for MySQL, than by reading about them for years.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: