And since SQL is a fourth generation declarative language, I really don't see how it could go the same way as assembly by being replaced with imperative programming. It's already more expressive and succint, and have stronger abstractions from implementation details, than imperative programming languages.
Hibernate for Java, SQLAlchemy for Python or Class::DBI for Perl (never used that last one) would be good examples for ORMs that blend well with the language they're written for.
Performance may vary across different ORM modules; the best-of-breed ones are certainly as fast as if you'd create the SQL yourself.
http://search.cpan.org/~frew/DBIx-Class-0.08123/lib/DBIx/Cla...
If you just want to persist your application objects, then KiokuDB is even better:
How is Active Record with regards to performance under load?
clients = Client.all(:limit => 10)
clients.each do |client|
puts client.address.postcode
end
looks harmless but requires eleven sequential round-trips to the database. This version clients = Client.includes(:address).limit(10)
clients.each do |client|
puts client.address.postcode
end
still requires two, and one of the queries gets bigger as the number of ids increases. You can get into find_by_sql, but at that point ActiveRecord isn't adding any value.In addition, ActiveRecord also supports joins instead of using includes. Includes is almost always fine, unless the initial result set is large (100+ rows).
@foo = Foo.create
@bars = Bar.find_all_by_some_attribute(:a)
@foo.bars = @bars #--> slow!
http://kevinlochner.com/rails-performance-inefficiencies
With Active Record you rarely if ever need to write SQL any more.
http://guides.rubyonrails.org/association_basics.html
http://guides.rubyonrails.org/active_record_querying.html
I think SQL is slowly going the way of assembly language over time - still useful to write by hand in special cases but most of the time you want to write in something higher level and have it generated automatically.