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

From: Carl Rosenberger <carl_at_db4o.com>
Date: Mon, 23 Jul 2001 11:34:43 +0200
Message-ID: <9jgr7r$vb8$02$1_at_news.t-online.com>


Bob Badour wrote:
> > > If OIDs provide the equivalent of logical identity and the system does
 not
> > > expose the OID, how do users differentiate among objects with the same
> > > value?
> >
> > if(object1 == object2){
> > }
>
> If the OID (or some other pointer) is not visible to the user, how
> could the test ever fail when the object values are the same?

???

The test can very well fail:

Person bob1 = new Person("Bob");
Person bob2 = new Person("Bob");
if(bob1 == bob2)
// will return false

A similar example comparing the results of two queries:

ObjectSet results = db.get(new Person("Bob")); while(results.hasNext()){
  Person bob1 = (Person)results.next();
  ObjectSet compare =
    db.get(new Person("Bob Badour"));
  while(compare.hasNext()){
    Person bob2 = (Person)compare.next();     if(bob1 != bob2){

       System.out.println("Not all Bobs are Badour.");     }
  }
}

Where are OIDs or pointers in the above example?

> > Which object databases have you been experimenting with and when? You
> > provide us with so many false statements
>
> You, Carl, are the one who makes false statements. I have identified
> scores of them, and I have explained how the statements are false. You
> cannot point to a single false statement I have made and explain why
> it is false! How is that for a challenge?

Why don't you answer my question? With which object databases have you been experimenting?

Some of the false statements that you have posted:

False 1: Relational databases are object databases.
False 2: Object databases expose pointers.
False 3: Object databases do not have performance advantages.
False 4: Object databases add complexity in handling objects.


> > > > How does your "mapping objects to columns" (domains) approach take
 care
> > > > of object identity?
> > >
> > > Logically and correctly -- by using candidate keys.
> >
> > How would those keys be represented in objects?
>
> Some object variables/values provide identity for other object
> variables by identifying tuples. However, once we have established the
> identity of an object variable, we do not need to internally represent
> the identity.
>
> Your question equates to: How does Java represent variable names in
> objects?

No.

Identity is a concept present in the programming language. If the database engine ensures single instantiation of stored objects, it persists the identity concept of the language. No exposed keys are needed.

> > Please give an example.
> >
> > I have the following class:
> > class Person{
> > String firstName;
> > String lastName;
> > }
> >
> > How would your "mapping objects to columns" approach tell one "Bob
 Badour"
> > apart from the other?
>
> Given your design above, how would your users tell one "Bob Badour"
> apart from another?

if(person1 == person2)
...as I have stated above.

Again:
How would your "serialize objects to columns" mechanism tell two objects apart?

Kind regards,
Carl

---
Carl Rosenberger
db4o - database for objects - http://www.db4o.com
Received on Mon Jul 23 2001 - 11:34:43 CEST

Original text of this message