Live data from Hacker News

(Some) ORM haters do get it

revision-zero.org

11–20 of 108 posts

Re: (Some) ORM haters do get it

#12
I don't understand where this ORM 'divide' is coming from.

ORMs are powerful, because they let you say less and do more. For 90% of the queries out there, an ORM is fine.

SQL is powerful, because you can control and fine-tune your statements. For the remaining 10%, use SQL.

Are ORMs bad? No. Can you them for everything? No.

The same thing can be said for almost every technology in existence.

Re: (Some) ORM haters do get it

#13
post #7

Can anyone point out the coup de grâce the author seems to think he has arrived at? He points out some (well known) ways that ORM's can be used inneficiently, and acknowledges the techniques that have been developed to work around these, but then seems to conclude that he has proven once and for all that ORM's are bad. I totally missed the connection on that part. Is it that SQL is better in dealing with sets than an…

The connection (according to the author as far as I've understood him) is: "All the techniques that have been developed to work around the inefficiencies of ORMs are just reinventing the wheel. The solutions have been there for 40 years and your workarounds are only needed because you think about individuals (object-orientied) instead of sets (relational)."

your workarounds are only needed because you think about individuals (object-orientied) instead of sets (relational).

What if it's better structurally for the program as a whole to think about individuals?

Re: (Some) ORM haters do get it

#14
Well now I'm reminded of my initial though when a colleague first introduced me to an ORM: "It feels wrong to use this tool to just map every object to a table." Of course I went on to write many, at best, moderately complicated web apps very fast using NHibernate and didn't miss writing vender-specific SQL or column to property mapping boilerplate.

But this article is a breath of fresh air. I may just try Dapper for the next project

http://code.google.com/p/dapper-dot-net/

Re: (Some) ORM haters do get it

#15
post #9

Earlier quoted context omitted.

Batch updates aren't where it ends. As a Django developer with a strong SQL background I find my hands are tied far more often than I would like. Sometimes this is caused by bugs like the current group by bug[1], other times it's caused by the design of the ORM. I do agree that the ORM is handy for things like "Get me all the things in this table", and "update this single record using a form", but this author is dead…

Django's ORM is a piece of junk compared to a proper one such as SQLalchemy, hibernate or nhibernate. I wouldn't go drawing conclusions until you've experienced something else.

If Hibernate is one of the "proper" ones, then I can happily declare ORMs to be a non-working, time-wasting, over-complicated POS.

Re: (Some) ORM haters do get it

#16
I think the other point the author makes is that it's not possible to write efficient code that is entirely abstracted from the underlying data (see his loop examples).

i.e. if you have to write your code in a specific way to make the ORM behave correctly (constantly thinking about what kind of sql your code is generating), then the abstraction becomes a lot less useful.

Re: (Some) ORM haters do get it

#17
post #9

Earlier quoted context omitted.

Batch updates aren't where it ends. As a Django developer with a strong SQL background I find my hands are tied far more often than I would like. Sometimes this is caused by bugs like the current group by bug[1], other times it's caused by the design of the ORM. I do agree that the ORM is handy for things like "Get me all the things in this table", and "update this single record using a form", but this author is dead…

Django's ORM is a piece of junk compared to a proper one such as SQLalchemy, hibernate or nhibernate. I wouldn't go drawing conclusions until you've experienced something else.

I unfortunately have to agree wholeheartedly

Sure, if you're doing a simple CMS, a simple system (even with Django Auth), Django ORM is fine

If you have anything slightly complex (several relationships between models) watch it fall apart

Re: (Some) ORM haters do get it

#18
For easiest things SQL is cumbersome.

Getting single row by primary key which is 90% of access is overly verbose in SQL so ORM wins.

For slightly more complicated cases SQL is much faster and easy to write so people who have to increment field in all rows that satisfy simple condition go: "ORM sucks".

But for more complicated cases like trimming data tree in some places SQL quickly becomes too much of a puzzle for most programmers to deal with so they prefer ORM again because it's doable there and most of the times works. Dedicated SQL users who are not good at puzzles in such cases write full fledged program (if their SQL dialect allows for that) and instead of bringing data to their iterative or recursive programs they bring their programs to the data which creates hard to debug, unreadable often unversionable monstrosities.

There should be some merge between databases and programming languages that could combine beauty of syntax of modern programming languages and efficiency of massive data handling of modern databases.

Why is it ok to have standard hashmap implementation in a language but not file backed hashmap or btree index?

Re: (Some) ORM haters do get it

#19
The idea of translating the declarative way of doing things to an imperative approach (that's basically what ORMs are doing) is imho a huge failure. It just never worked decently.

These days, we have languages which integrate rather nicely into the declarative mindset, so no need anymore for such bizarre "paradigm translators".

Post reply on HN