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 ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 |