DEV Community

Cover image for SoC - Separation of Concerns
Suspir0n
Suspir0n

Posted on

SoC - Separation of Concerns

Hello guys, today I start one more chapter of my Logbook. The subject is about SoC(Separation of concerns), we're bringing many principles, right? Let's see an example to understand this concept, right? OK, let's go guys.

What is the SoC?

Separation of concerns - SoC

As cited in O'Reilly "Separation of Concerns (SoC) is a design principle that manages complexity by partitioning the software system so that each partition is responsible for a separate concern, minimizing the overlap of concerns as much as possible."

This principle aims at separation of concerns software, taking care of each concern, as Garo Garabedyan said in "Separation of Concerns (since 1974). Concern == feature of system. Taking care of each of the concerns: for each one concern, other concerns are irrelevant. Hiding implementation of behavior."

I still don't understand, could you explain better?

So, Separation of Concerns (SoC) is the process of dividing a computer program into distinct resources that overlap in functionality as little as possible. Just like Garo Garabedyan said, he takes care of each one of the concerns, and each concern we can refer to the resources or behaviors of the system.

You must be wondering what is the difference between SoC and Single Responsibility Principle (SRP).

  • Single Responsibility Principle (SRP) - The SRP aims to separate the responsibilities, in this case, to have a single responsibility. Read more. About the Separation of Concerns (SoC)

  • Separation of Concerns (SoC) - The SoC takes care of every concern of the system, being any part of interest or focus in a program.

The difference is, the SRP is concerned with separating the responsibilities that each functionality of the system has, making it unique, and the SoC takes care of the concerns, so the SRP is coupled with the SoC as it is a concern of the system.

SoC in practice

separation of concerns

In this example just above you can see one of the uses Separation of Concerns (SoC), we can see that it separates two concerns of the program, the Report and the Dialog Program, The Report is nothing more than the reports that the program makes available and the Dialog program is the dialog that the system will be doing, this communication with the other computers. It's demonstrates that when we talk about separation of concerns, we only deal with program concerns, it can be with database, external systems, anything that involves a program concern.

This was the Logbook #14. Today I chose to speak about SoC(Separation of Concerns) next week I will bring about Avoid Premature Optimization guys. Let's say goodbye for here. We will come back in another logbook.

This article was helpful to you?
Leave a comment below.

References

Oldest comments (0)