Tutorial: How to Apply Software Architecture Cohesion Principles to Spring Boot Application
Cohesion Principles: RRE , CCP and CRP applied to the real world example
After discussing S.O.L.I.D. principles, it is time to take a look at Software Component Principles. In first set of principles , we talked about principles where we question how to structure software system in more low-level: classes, interfaces, methods. Here we discuss principles in more high-level, where we consider patterns how we build micro services, components, plugins, packages. Component principles have two main directions: Cohesion Principles, Coupling Principles. Today we are going to treat Cohesion Principles and its’ implementation to Spring Boot Application.
In Cohesion Principles the main concern is structuring software components based on their cohesion. If classes belong to each other, they should be built together. Three main principles here are:
- REP: Reuse/Release Equivalence Principle
- CCP: Common Closure Principle
- CRP: Common Reuse Principle
REP means that the classes and modules that are formed into a component must belong to a cohesive group. The component cannot simply consist of a random hodgepodge of classes and modules…