Re: OO and relation "impedance mismatch"

From: Kenneth Downs <firstinit.lastname_at_lastnameplusfam.net>
Date: Mon, 04 Oct 2004 16:28:11 -0400
Message-ID: <robsjc.pms.ln_at_mercury.downsfam.net>


Fredrik Bertilsson wrote:

> OO people often claims that there are an impedance mismatch between
> the OO model and the relational model, that makes it very hard use a
> relational database when you are using an OO programming language. I
> am wondering if "relational" people at this forum feel the same thing,
> that it is hard to use a OO language when you are using a relational
> database?
>
> /Fredrik

The problem is not OO vs. RDM, but code vs. data.

Consider that code, as a set of instructions, can be likened to a recipe. It tells you what to do. An organized person will have a nice little index box of recipe cards, or perhaps a bookshelf, but they will know how to find the right recipe when they need it.

Data, on the other hand, is things. It is flour, water, and pies. An organized person will have pantries for flour and refrigerators for pies.

When programmers of any flavor, including OO, start to try to work with data, they fail to recognize this very basic difference and start storing their recipes in the refrigerator and pouring flour onto the bookshelves. As the resultant problems pile up, they vaguely sense they are missing something, and we get terms like "impedance mismatch."

Even the statement of the problem gets it backward, "...makes it very hard to use a relational database when you are using an OO programming language." The statement betrays a misunderstanding about what customers are paying for. Nobody goes into a restaurant and orders a recipe, they order the pie!

Because the user orders food, not recipes, the analogy means that customers want correct data, they don't care about the program used to manage it. Therefore as developers the question is not, "how do I force a database to play with my OO language?", but is rather, "where do I vest the responsibility for managing biz rules, and having decided that, what language is best to do it?"

-- 
Kenneth Downs
Use first initial plus last name at last name plus literal "fam.net" to
email me
Received on Mon Oct 04 2004 - 22:28:11 CEST

Original text of this message