Tuesday, March 14, 2006

O/R Mapping — Ooh! I'm all w–ahem, ears.

Folks talk about the impedance mismatch between object-oriented views of data, and relational (as in "relational database") views of data. Specifically, they talk about the havoc that this wreaks on people trying to implement O/R mappers.

Ted Neward (of 2003) writes:
Basically, I want the object-relational impedance mismatch to go away, just like everybody else does. But instead of continuing to try to force objects on top of the relational model, how about we give up going in that direction, and instead try lacing relational semantics into our favorite languages of choice?

He's right about the fact that we try and force objects onto a relational model, and he's got a point that lacing relational semantics into our language would lessen the mismatch, but he's solving the wrong problem. Getting rid of the O/R mapper stops us from forcing classes into a relational model. We've still got our data to contend with, and as long as we're human, this means we're still forcing objects onto a relational model.

Compare the following hypothetical SQL statement:
select s.name
from classes c, classes_students cs, students s
where c.name = "Japanese Tea Ceremony and Zen Aesthetics"
and c.id = cs.class_id
and s.id = cs.student_id
to the following hypothetical hypothetical language statement:
select c.student.name
from classes c
where c.name = "Japanese Tea Ceremony and Zen Aesthetics"

Maybe while we're all lacing relational semantics into our favorite OO languages, we should think about lacing OO semantics into our relational languages...


Post a Comment

<< Home