Retrieving PhoneNumber in a list of generalised ContactInformation objects?

0
I've seen this set-up of Contact Information domain modeling, which generalises the different  'person' or 'user' object into one entity and uses generalisation for contact information (i.e. Email, Phone, etc.). This might seem great, but I'm having difficulties retrieving one specific specialisation when an AbstractPerson has (obviously) multiple forms of contactinformati. Let's say I have a details page with four columns and in each column I want to show a different piece of contactinformation. The person in context has an Email, address, phonenumber and bank account (thus an array of 4 objects). How would I show, for say, the phonenumber seperate from the whole list? - - -   I hardly doubt this is correct: (ignore the domain name (CRM_v2 .. )
asked
1 answers
1

With this domain model, you have no guarantees over what information you receive (which might be true, but it's very inconvenient): you could get a dozen email addresses, none of which are primary, since a home address might be primary. I'd add more IsPrimary attributes (IsPrimaryEmail, IsPrimaryAddress). Then, add a 1-1 association between AbstractPerson and EmailAddress and fill it if IsPrimaryEmail is true, or if this is the only email address connected to the AbstractPerson. With this association, it's easier to build your page, while remaining true to the way the data has been modeled.

 

Furthermore, have a chat with the people who create the domain models. I've had a project which contained data architects who drew diagrams like this. That is fine for a conceptual model of the data in your project (or business), but you always need a 'technical domain model' to fulfill requirements in a maintainable fashion.

answered