3 ms·
>> The birth of ORM lies in the fact that SQL is ugly and intimidating I disagree. In my opinion, the birth of ORM lies in the fact that a lot of people want t
by nlawalker 16y ago
>> The birth of ORM lies in the fact that SQL is ugly and intimidating
I disagree. In my opinion, the birth of ORM lies in the fact that a lot of people want to work on problems that have almost nothing to do with SQL but need persistence. They want to spend time working with objects in their domain model and just have persistence that works.
So if that's the case, why did ORM even appear? Why didn't everyone just spend time figuring out "NoSQL"/key-value stores/object stores and move away from RDBMS? 1) SQL and relational data stores, as the author himself points out, are trustworthy and standard. People may not like working with them or be intimidated by them, but most people can at least figure out simple joins and things. The relational model may not be the best answer for some things, but it at least gets the job done. 2) Just because I want to work with my domain objects in my application, and just because I'm short-sighted and all I care about at the moment is enabling a business idea or solving an interesting problem with my app, doesn't mean that I won't want to "get answers" from my data in the future. Maybe it won't be me - maybe it'll be another group in my company with more RDBMS knowledge than I have that's interested in data-mining my store, and because I've used an RDBMS, it will work extremely well.
I don't think developers are scared of SQL, I think they just don't care about working with it because it doesn't have much to do with what they're interestd in. Maybe ORM isn't a perfect solution, but it lets me have my cake (persistence that gels with my domain model) and eat it too (a relational backend when we need BI and reporting).
- mistermann 16y agoI agree. The OP seems to fall into the camp that, if ORM can't replicate everything that you would do in native SQL, then therefore ORM is bad. Which is absolute nonsense of course. I just don't see how the pure SQL people and ORM people are philosophical opponents, other than how ORM tools make dealing with SQL (which is an awesome, proven technology) so much easier, I suppose it could theoretically be a threat to their livelihood. The way I see it, they are partners in the same cause. I'm the same as you, I write applications that need to store and interact with data. The difference between using an ORM or not is like light and day, and for me, this constitutes 90% of my work. Certainly, there are situations where it is just common sense to drop down to raw SQL (and if your ORM doesn't support this, you are screwed), but people like the OP seem to subscribe to the "throw the baby out with the bathwater" philosophy of life....if you can find a single problem with a solution, throw the whole thing out. This is one of those arguments that will never, ever go away. I used to be passionate about the subject, but I don't care much anymore. The anti-ORM people will continue to say it doesn't work (ever), while the pragmatists will continue to use ORM because it does work, and for the edge cases, they will drop down into pure SQL, which most developers know very intimately anyways. On a related topic, how many DBA's have you met that understand SQL, query plans, etc deeply, and have a strong knowledge of database system tables (as well as you do as a developer?) Most DBA's I've met basically follow: http://en.wikipedia.org/wiki/Argument_from_authority http://en.wikipedia.org/wiki/Argument_from_authority
- wlievens 16y agoThe reason pure SQL people and ORM proponents don't always get along is that ORMs make it very easy to write really crappy queries. I'm fully in the ORM camp, but it is true that I can't turn on SQL statement logging without being terribly embarassed. And tuning and optimizing these queries isn't always as trivial as some make it sound. For fetching some data, it's not terribly hard, but try explaining to Hibernate that you want to bulk delete a bunch of objects (with inheritance) without screwing up your session...
- kunley 16y agoIt's all about people, not the ORMs or other technical inventions. Most shithead queries I encountered during years of DBAing were written by hand by poor folks abandoned by their colleagues and over-confident managers. Just no one cared to educate them, but everyone expected "progress" from them. So they did what they could.. In fact I wished many times that they used some abstraction layer which would save them from doing such harm, simply because this layer would be written by more educated people.
- steveklabnik 16y ago> I suppose it could theoretically be a threat to their livelihood. Bingo. Every time I've seen someone hating on an ORM, it's always a DBA. You wouldn't believe the number of queries that I've written by hand while thinking "ActiveRecord would have just written this for me" because An ORM Couldn't Possibly Be Performant Enough For Us!
- mseebach 16y agoThe OP seems to be very fond of SQLs ability to answer questions about your data: ORMs are very good for quickly and easily putting your apps data in a RDBMS, so you can answer questions about its data using SQL.