Why ORM is a bad idea

351689631_cd2fd0698d

Zemanta has started as a single Django project (called Neith - maybe Andraž will take time to explain the origin of the name in the comments) that over the years spun off many other Django projects, as we discovered that Django applications bear no similarities besides the name to the true applications, and would therefore better be called modules instead. But the original Neith Django project still lives, though its scope of functionality has been limited over the years, and it is now doing only aggregation of blogs and articles. I was fixing a bug in our Neith project (yes, even at Zemanta we have bugs) recently, so I have quite a fresh insight of what becomes out of a project which continuously grows for five years and whose performance requirements has grown from requiring handling thousands of feeds and 10 thousands' of articles to handling 100 thousands of feeds and millions of articles. One particularly sad aspect of this growth is the amount of dirty tricks that had to be used in order to overcome limitations of Django's ORM and to fully utilize the underlying database. Just looking at this code it is evident that ORM has not fulfilled it's promise of providing abstraction layer over the relational database, since there are so many leaks in this abstraction. While there might be some initial gains in using ORM for rapid prototyping, they are quickly offset by all the hassle required to overcome ORM's limitation once the performance requirements increase. In my opinion ORMs have no future and they should be replaced with something that really helps programmers not hinder them.

For alternative opinion see the next article:

ORM Haters Don't Get It

I've seen tons of articles and comments (especially comments) that tell us how bad, crappy and wrong is the concept of ORM (object-relational mapping). Here are the usual claims, and my comments to them: "they are slow" - there is some overhead in mapping, but it is nothing serious. Chances are you will have much slower pieces of code.

We need this to understand how you use our service - you can take it out if you like. Cheers, your Blogspire team.

via: www.javacodegeeks.com