January 2018
Beginner to intermediate
312 pages
7h 22m
English
In the previous two chapters, we saw how we could use types to do domain modeling in a general way. In this chapter, we’ll apply what we’ve learned there to our order-placing workflow. Along the way, we’ll look at a number of techniques that are useful for modeling any workflow. The goal, as always, is to have something that is readable by a domain expert.
So let’s revisit the steps in the Place Order workflow. Here’s the summary of what we need to model:
| | workflow "Place Order" = |
| | input: UnvalidatedOrder |
| | output (on success): |
| | OrderAcknowledgmentSent |
| | AND OrderPlaced (to send to shipping) |
| | AND BillableOrderPlaced (to send to billing) |
| | output (on error): |
| | ValidationError |
| | |
| | // step 1 |
| | do ValidateOrder ... |
Read now
Unlock full access