Book Image

JavaScript Domain-Driven Design

Book Image

JavaScript Domain-Driven Design

Overview of this book

Table of Contents (15 chapters)
JavaScript Domain-Driven Design
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 not relevant. As we model this in our domain, we want to carry this important knowledge across and have a way to associate the message in the process of delivery with the appropriate deliveryman. In code this can be done more easily; we might for...