Re: EOModel needs an easy tweak
Re: EOModel needs an easy tweak
- Subject: Re: EOModel needs an easy tweak
- From: Farrukh Ijaz <email@hidden>
- Date: Sun, 7 Nov 2010 03:03:35 +0300
Hi Chuck,
All the entities (A, B, C, and D) eventually have become IS-A relationship. I would also like to use interface instead of inheritance but thinking how I can manage the Entity E to have toOne relationship for all these entities using interface. May be I need to write custom code to manage the storage and retrieval for this relationship? Any clue or reference to existing example would be helpful.
Thanks,
Farrukh
Sent from my iPhone
On 2010-11-07, at 1:00 AM, Chuck Hill <email@hidden> wrote:
> If all they share is a few common, generic attributes, I would not use inheritance for this. I'd prefer an interface. As Mark pointed out, inheritance is for "IS A" relationships. It is not to save some implementation time. That is an abuse of inheritance. If they share behavior, then inheritance is more likely the correct design.
>
> Barbara Liskov has some excellent articles on this. Google for "Liskov Substitution Principal".
>
> Chuck
>
>
> On Nov 6, 2010, at 12:23 PM, Farrukh Ijaz wrote:
>
>> Yes, they will expose certain properties which are symmetrical in all the entities, e.g. title, description, etc.
>>
>> Consider this requirement as a tree structure which can have nodes that appear to be symmetric but their underlying user object can be different.
>>
>> Farrukh
>>
>> Sent from my iPhone
>>
>> On 2010-11-06, at 9:58 PM, Steve Peery <email@hidden> wrote:
>>
>>> Is there any shared functionality between Entity A, Entity B, Entity C and Entity D that would justify Abstract Entity Alpha?
>>>
>>> Steve
>>>
>>> On Nov 6, 2010, at 7:39 AM, Farrukh Ijaz wrote:
>>>
>>>> Hi EOF-ologists,
>>>>
>>>> I've a modelling issue and need to know what could be the suitable fix (or tweak) to fulfil the requirement.
>>>>
>>>> Below is the existing EO Model.
>>>> <Existing.png>
>>>> I've two entities (Entity A and Entity B) extending Abstract Entity X but these entities have their own tables (no single table inheritance). I need to design Entity D and Entity E where Entity D has a toMany relationship with Entity E and Entity E needs to have a toOne relationship with Entity A, Entity B, Entity C and Entity D.
>>>>
>>>> 1. One way can be for Entity E to have four different relationships such as toEntityA, toEntityB, toEntityC and toEntityD. (This is _not_ desirable)
>>>> 2. The other way mentioned in the lower diagram where Entity A, Entity B, Entity C and Entity D extend Abstract Entity X and Entity E will have toOne relationship with Abstract Entity X. (This is _desirable_).
>>>> <Desired.png>
>>>> What would be the easiest way to model such relationship? I'm _not_ relationship expert so may be the way I assumed the model (second diagram) can be wrong or practically impossible?
>>>> Also note that I cannot make Entity C and Entity D to extend Abstract Entity X due to some design constraints therefore I think to introduce Abstract Entity Alpha.
>>>>
>>>> Thanks,
>>>>
>>>> Farrukh
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>> _______________________________________________
>> 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
>
> --
> Chuck Hill Senior Consultant / VP Development
>
> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
>
>
>
>
>
>
>
_______________________________________________
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