5 Modelling Domain Behaviors
This chapter covers
- Modeling complex behaviors as pipelines
- Letting data guide the design
- Making illegal Behaviors impossible to represent
We’re going to leave the cozy and safe worlds of oil curing and checklists and jump head first into the messy, frantic world of software development. No more isolated modeling. We’re going to take the data-oriented tools we’ve learned and apply them to building a complete feature.
This means dealing with everything that makes software development hard. Databases, frameworks, services, and, worst of all, existing legacy decisions. Everything in this chapter will be done inside of an existing application (one we’ll make up as we go). We’re going to learn how to carve out a world built on data inside of an existing one built on mutation and identity objects.
This chapter will be challenging. The feature we’re going to implement is non-trivial and built from complex requirements. At the end of this, you’ll be battle hardened and have all the tools needed to tackle any feature in your own applications.
Let’s get started!
5.1 "Encouraging timely payments"
We're going to explore the spiritually fulfilling world of invoice processing and charging late fees. (Or, as it's known in corporate speak, "implementing systems which encourage timely payments.") Customers aren't paying their bills on time, and the accountants can't keep up, so we're going to automate their process.