The fallacy of the always-valid entity
Posted by: Jeffrey Palermo,
on 14 May 2009 |
View original | Bookmarked: 0 time(s)
I use domain-driven design, and one of the core patterns in DDD is the entity. I wont go into a description of aggregates or aggregate roots, but the entity is a central pattern when implementing domain-driven design. I often encounter the desire by some developers to create an entity that guards itself against ever becoming invalid Lets consider the following example of a UserProfile class: public class UserProfile{ public string Name { get; set; } public Gender? Gender { get;...