The terms coupling and cohesion come from the world of structured programming, but they are also thrown about in the context of microservices. In this session, I look at the applicability of these terms to microservice architecture, and also do a deep dive into the different types of coupling to explore how ideas from the 1970s still have a lot of relevance to the types of systems we build today.
20. @samnewman
AND MICROSERVICES?
Module A
Module DModule B
Module C
Module E
Communication
between
modules is done
via network calls
“Modules” run on different
computers
Allows for easier
independent deployability
27. @samnewman
INFORMATION HIDING AND MICROSERVICES
https://blog.acolyer.org/2016/09/05/on-the-criteria-to-be-used-in-decomposing-systems-into-modules/
52. @samnewman
AND CONNECTIONS BETWEEN THEM?
“The connections between
modules are the assumptions
which the modules make
about each other.”
- David Parnas
53. @samnewman
AND CONNECTIONS BETWEEN THEM?
“The connections between
modules are the assumptions
which the modules make
about each other.”
- David Parnas
Information hiding is about
reducing the assumptions
one module has for another
58. @samnewman
EXPLICIT CONTRACTS?
Module DModule B
Need an explicit understanding of
the assumptions of consumers
To help us understand what can
change easily, and what cannot
Schemas can help!
106. @samnewman
CONTENT COUPLING
Order ID Status
123 PLACED
456 SHIPPED
WarehouseOrder Processor
Information hiding bypassed
Unclear what can safely be
changed in the Order service
107. @samnewman
CONTENT COUPLING
Order ID Status
123 PLACED
456 SHIPPED
WarehouseOrder Processor
Information hiding bypassed
Unclear what can safely be
changed in the Order service
Aka Pathological Coupling
113. @samnewman
IN SUMMARY
Information hiding is super important
Some coupling is worse than others
Information hiding, low coupling, strong
cohesion = Independent Deployability