The DRY Principle and Micro-Frontends
It is all about Reuse
“One of the most common misconceptions about Micro-Frontends is that they are all about reuse”
- Cam Jackson.
The DRY Principle
What if we apply the ”Don’t Repeat Yourself” Principle to Distributed Frontends?
A Common Scenario
Reuse is a nice idea in theory
In practice, Reuse is really hard to achieve and sometimes causes more work than duplicating the same feature.
Ownership Friction
When a reused feature that wasn’t designed with the third-party use cases in mind, it leads to conflict and at the end the effort is duplicated anyway.
So, do we reinvent the wheel again and again?
It depends...
Adding abstractions of top of Micro-Frontends could lead to tightly coupled components and removing the benefits of independent deployments.
It is all about the simple things
How do you reuse Micro-Frontends effectively?
Reuse is easier when you apply it to things that are:
- Small
- Atomic
Reuse is a nice side effect of Micro-Frontends, not the target.
Examples of effective Reuse
Conclusion and Recommendations
Does the feature change a lot?
Is the feature in active development?
Can you deploy independently?
Is the feature owned by a team?
Is there a clear roadmap for the feature and reuse has been accounted for?