Re: acceptable way to program

From: Chris Smith <cdsmith_at_twu.net>
Date: Sun, 2 Jan 2005 10:28:44 -0700
Message-ID: <MPG.1c41dd366759c261989822_at_news.altopia.net>


Chris Uppal <chris.uppal_at_metagnostic.REMOVE-THIS.org> wrote:
> It may help to consider the difference between:
>
> a) a program (or group of closely related programs) that
> happens to require (ACID) persistence.
>
> b) a program that is required to manipulate independently-existing
> data in a more-or-less public repository (database).

Indeed, I do find that to be a useful distinction. But,

> In my opinion, O-R technologies are mostly about (a) -- that is to say they
> provide a poor man's object database.

This isn't exactly true. There are a number of factors to consider when making use of O/R mapping technologies, and this is one of them. Some such technologies are extremely limited in terms of how their data is stored, and are only suitable for application-private data that uses a relational database by coincidence. Others are considerably more flexible, and can deal with data that's represented in a number of ways, and map from there to a number of different OO models.

Hibernate is a good example of the latter. I enjoy using Hibernate because I can do (or get someone else to do) intelligent database design without thinking of my application, and then I can pretty easily create an OO model of that data using Hibernate that's fairly easy to use from Java. Same goes for a pre-existing database. Indeed, I can create different OO models for different applications (which ought to be the way O/R mappers are used; good O/R mapping is a functional concern, and is not inherent in the data itself) and they will work together flawlessly, making connections to the same database.

That said, I know of no O/R mapper that's really universally outstanding in being able to map an existing database schema in an ideal way. Generally, you'll end up with some quite quirks in the OO model of the data. I imagine more flexibility could be provided by products in the future. Nevertheless, I don't think it's fair to characterize use of an O/R mapper for this as a hack, or to claim that it's different from the intended usage of the tool.

-- 
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Received on Sun Jan 02 2005 - 18:28:44 CET

Original text of this message