Associations

In the previous section, we saw that the delivery of a letter is dependent on a postman. There is a certain relationship between the letter and the person who delivers it, but depending on the domain, this relationship might not be a very strong or relevant one. It could be relevant for our dungeon master to know who delivered which letter, for example, in case every deliveryman is instantly imprisoned and held responsible for the content of the post he or she delivers.

The ways of the orcs might not be as understandable as the rules of business often are. In this case, we would want to make sure that we put a label on each letter and the postman who delivered it, associating the letter with a certain person. The other way around is ...

Get JavaScript Domain-Driven Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.