4 Patterns for infrastructure dependencies
This chapter covers
- Writing loosely coupled infrastructure modules using dependency patterns
- Identifying ways to decouple infrastructure dependencies
- Recognizing common infrastructure use cases for dependency patterns
An infrastructure system involves a set of resources that depend on each other. For example, a server depends on the existence of a network. How do you know the network exists before creating a server? You can express this with an infrastructure dependency, a relationship in which an infrastructure resource depends on attributes from other resources.
You can easily express the server’s dependency on the network by hard-coding the network identifier. However, hard-coding more tightly binds the dependency between server and network. Any time you change the network, you must update the hard-coded dependency. In Chapter 2, I raised the need to parameterize dependencies to promote reproducibility and evolvability. Passing the network identifier as a variable better decouples the server and network. A variable works between resources in a module, but how can you express dependencies between modules?