High Cohesion, Low Coupling in Service Design
What you'll learn: How to design microservices that are internally focused yet externally independent.
The Core Principle
High cohesion and low coupling are two complementary design principles that determine the quality of your service boundaries. High cohesion means everything inside a service is closely related and works toward the same purpose. Low coupling means services depend minimally on each other, communicating through well-defined interfaces rather than sharing internal details.
High Cohesion: Keep Related Things Together
When a service has high cohesion, all its components, functions, and data relate to a single, well-defined responsibility. For example, an OrderService should handle order creation, status updates, and order history—all order-related operations. It shouldn't also manage user authentication or product inventory; those belong elsewhere.
Think of it like a toolbox: A well-organized toolbox has all screwdrivers in one compartment, all wrenches in another. You don't scatter screwdriver bits among random tools.
Low Coupling: Minimize Dependencies
Low coupling means services can evolve independently without breaking others. Services should communicate through stable APIs or events, not by directly accessing each other's databases or internal logic. When OrderService needs customer information, it requests it through CustomerService's API rather than querying the customer database directly.
The restaurant analogy: A kitchen (service) doesn't need to know how the dining room operates. It receives orders through waiters (APIs) and sends back completed dishes. The kitchen can reorganize completely without affecting the dining room.
Why Both Matter Together
High cohesion ensures each service is focused and maintainable. Low coupling ensures services remain independent and deployable separately. Together, they enable true team autonomy and independent scaling—core benefits of microservices architecture.
Key Takeaway: Design services with tightly related functionality inside (high cohesion) while minimizing cross-service dependencies through clean interfaces (low coupling)—this maximizes independence and maintainability.