Re: Clean Object Class Design -- What is it?

From: Galen Boyer <galenboyer_at_hotpop.com>
Date: 22 Jul 2001 00:21:16 -0500
Message-ID: <usnfpxtn6.fsf_at_verizon.net>


On Sat, 21 Jul 2001, jim.melton_at_lmco.com wrote:

>> One would want the physical store independent of the logical
>> specification in any case. This is a good thing.

>
> Let's start with a naive question. Why?

The logical data model could, I guess, be considered the interface that the database provides for the application. The physical implementation of it shouldn't be known or cared to be known by the application.

>> Unless you normalize the data, how do you even know whether
>> you are enforcing all of the constraints?

>
> One of the basic principles of object-oriented programming is
> that a class is responsible for ensuring that its internal
> state is coherent.

But then the application programmer has to code this referential integrity. Let the database handle it.

> This statement does not imply any mechanism of achieving that
> constraint, particularly in the context of persistent
> data. However, the answer to the above question is that
> enforcing the constraints is a given in an object-oriented
> approach. While it may take extra thought and care in the
> relational world, it is a normal part of doing business in the
> OO one.

But the care and extra thought is a big part of the value that a data modeler will bring to an application design. Everybody cares about data integrity, but a database guy's first focus is that.

>> >These data constraints, however, are
>> >encapsulated in the code that is used to access the data.
>>
>> This is not good. Every application that gets written must
>> then enforce exactly the same constraints. This is better
>> handled by the database.

>
> No one said the code couldn't be part of the database. Now you
> are talking about specific implementations.

I don't understand you here. Are you saying that you want a tool to generate the data model so that the RI is handled by the database?

> I believe that any well thought object model will already be
> normalized, because that is the nature of object modelling. It
> is not necessary to have years of relational theory to create
> normalized models. It is possible to do a thing and not know
> someone else's name for the thing.

Well, this is a bit unfair to the relational world, don't you think? I wouldn't try to pass myself off as an experienced OO designer and I wouldn't hope an OO designer to do the same about data modeling.

>> Well, I would argue that a class model does not imply a proper
>> schema.  Certainly, one can automaticaly generate a schema
>> from a class model, but

 I
>> do not think the result would be very good. Doing so will tend
>> to bias the database toward a single application at the cost
>> of all other potential

 uses
>> of the data.

>
> You've made this claim several times. I don't get it.

He's saying the the database will be used by multiple apps and many different ad-hoc users, but if some tool designs the data model to fit a specific OO designed app, then it will rarely fit the needs of the rest of the users and apps.

> Sure, I've seen a lot of "single-use" object models. I've also
> seen "single-use" relational models. That's just a question of
> quality of modelling, not inherent superiority of one technique
> over the other.

I don't know if either side is claiming superiority, at least I won't, but when OO designers think that they don't need data modelers because all they need is a data model that supports their "perfect" OO design, then they are claiming superiority.

> Can you explain why (apart from slipshod, ignorant modellers)
> an object-oriented approach is necessarily biased to one
> application?

It isn't the OO approach. Its the application that was designed for a specific purpose which is necessarily biased toward itself.

> Can't we all just be friends?

I have always succeeded in this and it is not only desirable but of paramount importance. I completely respect the OO design, and I provide valuable input coming from a relational frame of mind. With the two, I have been part of some very successful database supported OO applications.

-- 
Galen Boyer
It seems to me, I remember every single thing I know.
Received on Sun Jul 22 2001 - 07:21:16 CEST

Original text of this message