Re: Object-relational impedence

From: Robert Martin <>
Date: Wed, 5 Mar 2008 01:05:30 -0600
Message-ID: <2008030501053015668-unclebob_at_objectmentorcom>

On 2008-03-03 18:24:33 -0600, Marshall <> said:

> One's requirements dictate data with certain functional dependencies.
> Among the easiest tasks in application design is one of the earliest:
> structuring the data. The RM structures data as relations. Relational
> structures lack query bias, which is one of the reasons why SQL
> is so good at ad hoc queries (compared to the other choices.)
> OO structures mandates an object structure (unsurprisingly): out the
> gate, one has no choice but to build in a query bias, whether
> one wants it or not.

Agreed. That "bias" can work very well if you only use the biased queries. That works well in the context of a single application, or a single piece of an application. It does not work well in the general case, which is why OODBs never quite took off.
> Furthermore, since OOPLs lack physical independence, traversing
> the graph may be quite expensive, particularly in the case where
> the graph is backed by storage in a database, which is part of
> why ORM is such a universally bad idea.

No, you have this wrong. ORMs generally use standard SQL queries to traverse and gather data from the DB. Then that data is placed into OO structures so that the application can take advanage of the bias.

Robert C. Martin (Uncle Bob)  | email:
Object Mentor Inc.            | blog:
The Agile Transition Experts  | web:
800-338-6716                  |
Received on Wed Mar 05 2008 - 08:05:30 CET

Original text of this message