Re: EOF Inheritance, Relationships between super class and subclass
Re: EOF Inheritance, Relationships between super class and subclass
- Subject: Re: EOF Inheritance, Relationships between super class and subclass
- From: Ian Joyner <email@hidden>
- Date: Mon, 3 Jul 2006 10:55:06 +1000
On 03/07/2006, at 7:27 AM, Mr. G Brown wrote:
Yes,
A VerifiedPatient would be a subclass of a PatientAlias (from a
Java perspective); they would have many properties in common,
methods, validations, etc. A VerifiedPatient would link (from a SQL
perspective) to many PatientAliases, and under each PatientAlias
there would then be links to information entered under that alias.
But from what I have read, there are bugs with inheritance, and it
might be better to just duplicate the common properties and
methods.....
No, all three WO implementations of inheritance work fine, so that
should not put you off. You might run into things that seem like bugs
if you misuse inheritance...
On Jul 2, 2006, at 4:39 PM, Ken Anderson wrote:
Mr G. Brown,
I think it would be necessary to understand your object model a
little more before being able to recommend if/how to use
inheritance. At the moment, I really don't see any entities you
have that are good candidates for inheritance, unless I'm
misunderstanding your problem. It seems to me like you need a
Patient entity and a PatientAlias entity, related Patient <->>
PatientAlias.
Yes, but from a Jave perspective the Patient is a subclass of
PatientAlias, or should be...
Can you please give us some more detail?
Well the above is the gist of it...
Consider Mary Smith, who has some tests, then next year is Mary
Doe, and gets more tests, then the next year is Mary Smith again,
who gets more tests, then the following year is Mary Rogers. Now
find all the info for Mary Smith/Doe/Smith/Rogers. And yes, an ID
number would work...in an ideal world where there weren't any typos
or mistakes with that property.
OK, you are describing a 'has-a' relationship, not an 'is-a'
relationship. Inheritance models the is-a relationship. From what I
read, each single person potentially has multiple identities. OO
modelling won't solve this problem, since it might take some
detective work to find that the patient presenting herself as Mary
Smith this year was Mary Doe last year. For this you might want a
previous records relationship, which you can link, once you have
found this to be the case. Or you might want to just resolve multiple
records into a single record, but that all depends on the policy of
the hospital, which it sounds like is the first.
The inheritance relationship would be used more for modelling common
attributes of PATIENT, DOCTOR, NURSE, STAFF_MEMBER as inheriting from
PERSON, or even better, DOCTOR and NURSE would inherit from
STAFF_MEMBER. Thus you have divided STAFF_MEMBER into categories or
subclasses depending on their role in the hospital.
Now it would be nice to extend a PatientAlias class to a
VerifiedPatient class, BUT with the "to many" and "to one"
relationships will that work?
Probably not.
or will that cause problems?
Probably.
Does EOgenerator work with inheritance?
Yes very well.
And what flavor of inheritance would work best here?
Most likely none.
Sounds like you need a good book to explain the ins and outs of OO.
Try Bertrand Meyer's very clear "Object-Oriented Software Construction":
http://www.amazon.com/gp/product/0136291554/102-6193962-6904136?
v=glance&n=283155
Well thanks for your insights.
My pleasure
Ian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden