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

Who is involved in the prisoner transfer?


In the previous sections, we did a lot of exploring in the domain to get a view of what has to be done to make actions in the system happen. With this knowledge, we can now get a clear-cut concept of how a prisoner transfer should happen. The tests we created earlier specify some behavior and collaborators we are aware of in the domain. We represent them as basic JavaScript objects that contain the properties necessary to satisfy the tests; we, for example, know that a dungeon needs a message inbox to be notified, but we don't know any properties for the prisoner yet. The following code provides some simple functions to let us describe the type of object we are using, as the code grows and our knowledge of what makes a prisoner or a dungeon gets solidified we can fill those out to continue to be stand-ins for the respective objects during our tests:

/* get a prisoner to transfer */
function getPrisonerForTransfer() { return {} }

/* get a dungeon...