- Given the
Employee object and a bunch of personal / organizational information (e.g. marital status, information about children, department, position). Should all personal information be presented as objects / values ββor is it better that the information is inside an entity class? Will using a design (which can collect all personal information) as a base object ( composition ) for an Employee object a poor design choice?
Also, how is this behavior correctly modeled (in terms of DDD ): If employee has kids then it should have a birth certificate (with corresponding data: name, issue date, etc) or If employee is married then it should have marriage certificate (with corresponding data: spouse name, etc) ?
For the case of children, I decided to use the ChildrenInformation value object:
public class ChildrenInformation { public String BirthCertificateCode { get;set; } public DateTime BirthCertificateIssueDate { get;set; } public ChildName { get; set; } public ChildMiddleName { get; set; } public ChildLastName { get; set; } public DateTime ChildBirthday{ get; set; } } public class Employee : AbstractEntity<Employee>, IAggregateRoot { public ISet<ChildrenInformation> ChildrenInformation { get; set; } /* other things ...*/ }
Wouldn't there be a design mistake?
EDIT
Another thought is to separate the Certificate class.
[Serializable] public class Certificate { public String Code { get; set; } public String Number { get; set; } public String RegistreeName { get; set; } public Address RegistreeAddress { get; set; } public String RegistreeDateOfBirth { get; set; } public String RegistredAt { get; set; } public DateTime DateRegistred { get; set; } } [Serializable] public class Employee : AbstractEntity<Employee>, IAggregateRoot { public Certificate Passport { get; set; } public Certificate MarriageCertificate { get; set; } public ISet<Certificate> ChildrenBirthCertificates { get; set; } }
Thanks!
source share