Design patterns·Modelling the domain
creating a valid aggregate needed four objects and a rule, so a separate object does it and the constructor stayed private.
Domain factory
Also calledfactory in DDD, domain-driven factory
An object or method whose job is to construct a complex aggregate correctly, when doing so requires knowledge that does not belong in the constructor. It is the domain-driven design use of the word, which is narrower than the creational patterns of the same name: the intent is protecting an invariant during assembly, not choosing among implementations. It disappears again as soon as construction is simple enough for a static factory method to carry.