Re: Object-relational impedence

From: Marshall <marshall.spight_at_gmail.com>
Date: Mon, 3 Mar 2008 16:34:39 -0800 (PST)
Message-ID: <b70ee184-31c4-4238-8468-6ed721aa7080_at_i7g2000prf.googlegroups.com>


On Mar 3, 8:52 am, JOG <j..._at_cs.nott.ac.uk> wrote:

>

> I was hoping perhaps people might be able to offer perspectives
> on the issues that they have encountered.

One piece of the puzzle that is often neglected is a qualitative difference in the type systems of some of the most popular OOPLs vs. SQL or a hypothetical relational language. This difference doesn't get a lot of ink in industrial settings but it's quite important.

C++ and Java and many similar languages are nominally typed; SQL is structurally typed.

For example, suppose I have two Java classes as follows (toy example for illustrative purposes):

  class Foo { int x; int y; };
  class Bar { int x, int y; };

The two classes are different; one cannot use an instance of one as an instance of the other under any circumstances, not even with a cast.

In SQL, if I have two relations with x and y int columns, I can union them, or join on them, or whatever. There is no way, in fact, to forbid such a thing, just like in Java there is no way to allow such a thing.

One particular manifestation of this difference is that if one is writing an ORM for Java, one has to address the issue that one needs a new class for every distinct column-set of every query one has. This fact sometimes drives unfortunate design decisions.

Marshall Received on Tue Mar 04 2008 - 01:34:39 CET

Original text of this message