4 The importance of loose coupling
This chapter covers
- The four types of software coupling
- Why it’s important to minimize coupling
- Techniques for designing loosely coupled software
Now that you have learned about the fundamentals of software architecture, let’s look at one of the most important architectural principles: loose coupling. Loose coupling is so central to good architecture and design that it deserves a deep dive. That’s because an architecture must be loosely coupled to satisfy key quality attributes, such as availability and ease of change. Without it, the application will most likely be difficult to change and prone to failure. If you have ever spent endless meetings trying to coordinate changes with other teams, then most likely you have experienced the pain of tight coupling.
To understand why loose coupling is important, we need to first define what is meant by coupling. Two software elements are coupled if one can affect the other in some way. Coupling manifests itself in various ways. In this chapter, I cover four different types of coupling. Two types of coupling - design-time coupling and build-time coupling - affect how quickly teams can develop and deploy software and so directly impact fast flow. The remaining two types - runtime and infrastructure coupling - determine the application’s runtime behavior, most notably, its availability and latency. Let’s start by exploring the concept of coupling.