Tutorial: How to Apply Software Architecture Cohesion Principles to Spring Boot Application

Cohesion Principles: RRE , CCP and CRP applied to the real world example

Ali Zeynalli


Photo by ElevenPhotographs on Unsplash

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; instead there must be some overarching theme or purpose that those modules all share.

In this principle our main concern is the cohesion of classes, packages, plugins in respect to its releasability. Go-live of a specific component should not be triggered by random changes in random classes. In contrast only together releasable components should be bundled together.

So version, tag or documentation of a release should gather only cohesive components.

CCP means gathering into components those classes that change for the same reasons and at the same times. Separate into different components those classes that change at different times and for different reasons.

This principle bases on Single Responsibility and Open-Closed Principle restated for high-level components. (please see my other blog series for those principles: SRP, OCP). This principle brings stability to a software meaning…



Ali Zeynalli

IT-Architect | BMW Group | M.Sc. Technical University of Berlin