Coupling | Cohesion — [Notes]
[Refer LLD Index for all LLD topics]
**Please read the article in its entirety, and if you’re inquisitive and want to dig deeper, click on any of the sources listed in this article.
**These are notes that I’m making for myself. I have cited the source for an image or piece of content, and all sources are listed again at the end of the article. Please read the sources to get the most out of this essay.
· Coupling
· Cohesion
· Functional Cohesion / Capability Centric
∘ Single Responsibility Principle
· Informational Cohesion / Entity Centric
· Why low level code is organized by technical concerns?
· How to handle coupling between highly cohesive services?
· How to handle coupling between mixed responsibility in code?
· References
Coupling
“degree of interdependence between software modules
Cohesion
“degree to which the elements inside a module belong together” — Structured Design: Fundamentals of a Discipline of Computer Program and Systems Design
Functional Cohesion / Capability Centric
- Grouped related to operations of a task.
Single Responsibility Principle
- When you write a software module, you want to make sure that when changes are requested, those changes can only originate from a single person, or rather, a single tightly coupled group of people representing a single narrowly defined business function.
- You want to isolate your modules from the complexities of the organization as a whole, and design your systems such that each module is responsible (responds to) the needs of just that one business function.
source — https://blog.cleancoder.com/uncle-bob/2014/05/08/SingleReponsibilityPrinciple.html
Informational Cohesion / Entity Centric
- Can drive high degree of coupling.
- Focus will be on data instead of functional boundary
vs
Why low level code is organized by technical concerns?
MVC — Model + View + Controller | generally each one of them has 1:1 mapping with each other
vs
Organize by Feature
How to handle coupling between highly cohesive services?
How to handle coupling between mixed responsibility in code?
- Can use Pipes and Filters pattern [Russian Doll]