Object Relational Mappers are evil (a meditation)

Diez B. Roggisch deets at nospam.web.de
Mon Oct 5 15:47:46 EDT 2009


Aaron Watters schrieb:
> This is a bit off topic except that many Python
> programmers seem to be allergic to typing SQL.
> 
> RESOLVED:  Using ORMs leads lazy programmers
> to make bad database designs.  It's better to
> carefully design your database with no invisible
> means of support and there is no reason to not
> use SQL directly for this purpose.
> 
> FOR EXAMPLE:  Consider blogging.  The most
> successful blog software is WORDPRESS.  Here
> is the WordPress data model:
> 
> http://blog.kapish.co.in/wp-content/uploads/2009/03/wp_2.7.png
> 
> Beautiful, isn't it?  It was designed by people who
> thought about what they were doing and did it carefully.
> 
> Now let's look at the Sakai Blogger tool data model
> (as reverse engineered by someone who had to
> fix a bug -- there actually was no data design created
> by the implementers):
> 
> confluence.sakaiproject.org/download/attachments/17072138/
> entitymodel.pdf
> 
> How did the above happen?  I suspect someone opened
> up Eclipse and started typing, relying on the Hibernate
> ORM to handle all the database stuff automagically.  The
> result is a massive headache for people like me.  Another
> one.  I routinely open up the mysql prompt and start typing
> "show tables", "describe table blah", "select * from blah limit 10"...
> trying to figure out WTF Hibernate did with my data.

I think your example is nonsense. Just comparing the two models based on 
"they both are for blogging" is like comparing a cessna to a 747 - yes, 
both are flying, but that's pretty much what they have in common.

It is pretty clear that sakai's data-model caters to a very 
sophisticated *user*-model, with roles and permissions, and whatnot. 
Plus other features. So it appears to be more in the CMS-league.

Now it's obviously easy to argue that this isn't needed for a simple 
blog. Nonetheless, it doesn't make a point about ORM. With any ORM I 
know (both in Java and Python) you could design the simple and straight 
model WP uses.

And I've seen my fair share of convoluted, trashy pure-SQL-based DBs as 
well.

So I think to make your point you need some more convincing arguments.

Diez



More information about the Python-list mailing list