Inter-system communication occurs when an application talks to another application across its boundary. Because that communication shapes the system’s externally visible contract, its messages and interaction pattern must remain backward compatible even as internal code changes. section 5.3
Separate communications by whether they cross the application boundary:
- Intra-system communication connects classes within the application. It is usually an implementation detail, so tests that verify these collaborations become coupled to refactoring-sensitive structure. section 5.3
- Inter-system communication connects the application to external applications. It is observable behavior and can legitimately be verified when its side effects are visible externally. section 5.5
- Treat out-of-process dependencies with care: an external system whose effects cannot be observed externally is still an implementation detail and need not be mocked. section 5.4
Verifying an external receipt
After a successful purchase, CustomerController sends a receipt through an email gateway. A resilient test checks the purchase result and verifies that the gateway received the customer address, product name, and quantity once. By contrast, verifying Customer’s internal inventory collaboration couples the test to implementation details. section 5.3
Figure 5.11. There are two types of communications: intra-system (between classes inside the application) and inter-system (between applications).
Use the communication boundary diagram to distinguish collaborations inside an application from interactions between applications. section 5.3
