3 ms·
No. I use ActiveRecord and DataMapper every day at home (and Hibernate at work), so I know the benefits (although I consider Hibernate more of a hinderance tha
by Xichekolas 19y ago
No.
I use ActiveRecord and DataMapper every day at home (and Hibernate at work), so I know the benefits (although I consider Hibernate more of a hinderance than a help after using the AR model). What I don't get is why everyone acts like SQL is hard or something. It's like one level up from HTML on the difficulty scale and one level below any real programming language. The advantage of the ORM is that 90% of the time you get what you want in an abstract way. It's not to protect you from SQL.
Any developer that is scared of SQL should probably look for another line of work.
- huherto 19y agoDo you use ActiveRecord with Java or .Net? It seems to me that DataMapper is more popular in Java but I don't about ActiveRecord.
- Xichekolas 19y agoUh... I use Hibernate with Java at work. My AR and DM usage is with Ruby (and specifically, merb) at home. Wasn't aware that Java had anything like DM. Have a link handy?
- ken 19y agoIt's "hard" because every SQL implementation is so different. AR pretends you can change one line in a config file to change databases (they even brag about it), but I've never seen it work that way. It also doesn't help that AR just leaves many of its own features unimplemented for various databases, and doesn't even mention them in the docs. I'm a bit scared of SQL because it's a pain to use, and I've used object databases with great success (and no pain). For complex queries, its pseudo-English syntax is more trouble than it's worth. And one of the most common uses today is full-text search, but SQL doesn't let you search that. (Officially, it doesn't even provide INDEXes; that's probably why CREATE INDEX syntax is not the same anywhere.) I don't understand why so many otherwise-great systems (like Rails) force you to use SQL. To take another example of a standard implemented by different companies, I've taken nontrivial Common Lisp programs from one compiler to another, and almost never had problems. I would have thought that CL would be a much harder standard to get consistent than SQL, but apparently it's not.
- ken 19y agoOK, I guess that was kind of long and rambling. It boils down to: 1. It's a pain, both in terms of what it provides and what it doesn't provide, compared to every alternative I've used 2. Despite being an ISO standard, it's a different pain everywhere 3. Even libraries which exist only to make it more consistent and less painful don't help beyond fairly trivial tasks on the 1 or 2 most popular free implementations If any other language had this property, I would not use it; SQL is no different.
- Xichekolas 19y agoI think the problem is as you say... the SQL standard is too small and hence anything outside the standard (but actually useful) is implemented differently on every platform. However, two points. First, the diffs aren't that huge (the underlying idea is generally the same, with some caveats, it's just the syntax that must be juggled). Second, most places I know usually pick one or two database systems and then make a very long commitment to them. There is no reason the developer shouldn't be able to pick up whatever SQL flavor his shop is using. My original point is that any developer worth his salt should be able to pick up new languages fairly quickly, and since SQL is like a mini-language, it should be learnable in mini-fairly-quickly time.
- mattjones 19y agoI don't think the problem is developers being afraid of SQL. There are still lots of Perl and PHP programmers who don't use ORMs. Instead, ORMs have been sold on the idea of database abstraction, and programmers have been made to feel that using raw SQL is bad practice.