
- Forum
- Testing
- Software Patterns
- Design Pattern help for this scenerio?.
Design Pattern help for this scenerio?.
This is a discussion on Design Pattern help for this scenerio?. within the Software Patterns forums, part of the Testing category; I need some expert advice on possible ways to design the classes for following scenerio. Subject domain has 3 types ...
-
05-13-2004, 11:45 AM #1KK Guest
Design Pattern help for this scenerio?.
I need some expert advice on possible ways
to design the classes for following scenerio.
Subject domain has 3 types of identities.
Lets say <IDType1>, <IDType2>. Because
both are identities and have some
commonality we can inherit them from a
base <Identity> type.
Then there is People who owns those IDs.
Some have only 1 ID and some have both.
The problem I have having here is this.
You should be able to add <Identity>
only with a person. So, basicaly I thought
to have a register method inside <Person>
which inturn call [Add] methods in IDentites.
Also, I cannot have [Add] methods inside
the IDType1, IDType2 classes as public
because then it will allow adding identites
without adding a <Person>
Having Identities as inner classes within
<Person> will solve the above issue,
but then, to provide functionality such
as listing/searching IDType1, IDType2
will also have to be done from <Person>
which is a bit silly (I guess)
Any body who can help me
with some design pattern here?
Regards
KK
-
05-19-2004, 08:49 AM #2Shashank Guest
Re: Design Pattern help for this scenerio?.
KK wrote:
> I need some expert advice on possible ways
> to design the classes for following scenerio.
>
> Subject domain has 3 types of identities.
> Lets say <IDType1>, <IDType2>. Because
> both are identities and have some
> commonality we can inherit them from a
> base <Identity> type.
>
> Then there is People who owns those IDs.
> Some have only 1 ID and some have both.
>
> The problem I have having here is this.
> You should be able to add <Identity>
> only with a person. So, basicaly I thought
> to have a register method inside <Person>
> which inturn call [Add] methods in IDentites.
>
>
Why it should call add method on identity?
> Also, I cannot have [Add] methods inside
> the IDType1, IDType2 classes as public
> because then it will allow adding identites
> without adding a <Person>
>
>
add method on person that takes argument Identify.
> Having Identities as inner classes within
> <Person> will solve the above issue,
> but then, to provide functionality such
> as listing/searching IDType1, IDType2
> will also have to be done from <Person>
> which is a bit silly (I guess)
>
> Any body who can help me
> with some design pattern here?
>
>
Or I missed something?
> Regards
> KK

Reply With Quote





