News for hackers. Stuff that matters.
Re:OrmHate by mindcrime on Tuesday June 26, 2012 @10:29AM (#4161981)
Because people are scared of things they don't understand? Or because they had one bad experience, years ago, with some home-grown crappy ORM, and now they assume all ORMs are bad? The reasons are legion...

The second of those is what I saw at my last job. The tech-lead / architect guy was vehemently anti-ORM... because a previous group (at the same company) had rolled their own ORM in Jython and embedded it into the Java codebase, and it A. didn't perform well and B. was extremely fragile and hard to modify. Now, you can't explain to him that there are well written, productive, performant ORMs like Hibernate. He just doesn't want to hear it. sigh

Re:OrmHate by jonstjohn on Tuesday June 26, 2012 @10:40AM (#4162057)
Or maybe people expect to interact exclusively through the ORM and when they have to do something more complex, conclude that the ORM is useless. When using an ORM increases the complexity of the code substantially over direct SQL, I'll usually switch to more comprehensible SQL.
Re:OrmHate by mindcrime on Tuesday June 26, 2012 @11:07AM (#4162246)
Well, at least in the case of Hibernate, it's easy enough to drop down to native SQL when you need it (although you obviously risk giving up database independence) and you can still keep the OOP "feel" by defining query post converters and what-not.

The points made above about "don't use ORM for reports" aside (a point I strongly agree with, btw), I've found Hibernate makes my life a lot simpler and rarely gets in the way or fails to do what I need it to do. But I do occasionally create a native query to deal with some edge case or whatever.

Re:OrmHate by einhverfr on Tuesday June 26, 2012 @12:22PM (#4162710)
Let's define a good ORM though.

A good ORM should be able to handle a database designed for a different application, normalized to 5NF or BCNF, using composite primary keys, composite foreign keys, and other solid db design concepts, and be able to reliably generate queries to bridge the gap, and should do so where sets of objects are required in a way that does not unduly burden the database with small queries that could be consolidated.

That's a hard problem. There are some ORMs that come pretty darned close if not there. Many more, in my experience fall well short.

Re:OrmHate by norkakn on Tuesday June 26, 2012 @12:48PM (#4162852)
What ones do you like? The Django ORM makes me want to vomit every day or so.
Re:OrmHate by stevenwei on Tuesday June 26, 2012 @02:01PM (#4163275)
The Django ORM is widely regarded as being vastly inferior compared to dedicated ORMs like SQLAlchemy. It's more of a 'get the job done, quick' solution (that works for simple use cases, but becomes difficult to use for anything more).
Re:OrmHate by einhverfr on Tuesday June 26, 2012 @11:10PM (#4165316)
The best one I have looked at was DBIx::Class