Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > modeling possible polymorphism?

Reply
Thread Tools

modeling possible polymorphism?

 
 
Elhanan
Guest
Posts: n/a
 
      10-24-2006
hi..

i have entity called AssuredPerson and entity called PolicyOwner, both
have similar attributes (meaning Abstract Person Class)

however an AssuredPerson can be PolicyOwner (but not the way around).

so i've added a property called isPolicyHolder (boolean) to
AssuredPerson.

is this correct way to go about it?

 
Reply With Quote
 
 
 
 
Manish Pandit
Guest
Posts: n/a
 
      10-24-2006
Ideally, if the attributes are same, this seems more like 'has-a'
relationship. There is a Person who "has" a Policy. The qualification
of a person being "assured" depends on him "having a" valid policy. So,
the entities could be a Person and a Policy IMO.

-cheers,
Manish

 
Reply With Quote
 
 
 
 
Elhanan
Guest
Posts: n/a
 
      10-25-2006
yes but it may be possible the PolicyHolder may have differen
attributes then AssuredPerson Attributes, it could be 2 different ppl
or the same person.

Manish Pandit wrote:
> Ideally, if the attributes are same, this seems more like 'has-a'
> relationship. There is a Person who "has" a Policy. The qualification
> of a person being "assured" depends on him "having a" valid policy. So,
> the entities could be a Person and a Policy IMO.
>
> -cheers,
> Manish


 
Reply With Quote
 
Tom Forsmo
Guest
Posts: n/a
 
      10-29-2006


Elhanan wrote:
> yes but it may be possible the PolicyHolder may have differen
> attributes then AssuredPerson Attributes, it could be 2 different ppl
> or the same person.


This is a dynamic role issue. so instead of modelling it as two
different person type classes, which have the well know limitation of a
person only being able to have one role/function, you should rather have
a person class with a "has-a" relationship to some role objects. This
allows you to combine persons/roles as you desire dynamically.

These role objects could then contain the specifics of that persons
role. This would support dynamic/run-time changes in a persons role. In
contrast to the static class model you originally proposed, which would
require changes to the code every time a new person/role relationship is
invented.

For a policy you would follow the same principle with regard to people
involved in the policy, e.g. say you needed to create a new policy where
there was a third participant in the policy, e.g. "PolicyGuardian".
With the dynamic version you only need to add the PolicyGuardian class
and a couple of methods to deal with that participant, and you are ready
to go.

tom

>
> Manish Pandit wrote:
>> Ideally, if the attributes are same, this seems more like 'has-a'
>> relationship. There is a Person who "has" a Policy. The qualification
>> of a person being "assured" depends on him "having a" valid policy. So,
>> the entities could be a Person and a Policy IMO.
>>
>> -cheers,
>> Manish

>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to combine object-oriented modeling well with database modeling? tenxian Java 2 04-08-2008 01:02 AM
Interest in conceptual data modeling (fact-based modeling)? Clifford Heath Ruby 2 02-07-2007 07:09 AM
Modeling tools for State machines... Stefan Oedenkoven VHDL 2 07-29-2004 10:32 AM
Re: Modeling tools for State machines... Tom Verbeure VHDL 0 07-26-2004 02:26 PM
Modeling hardware in Matlab/Simulink (delay, etc.)? moe VHDL 1 10-26-2003 08:38 PM



Advertisments