SoC - Separation of Concerns
Tags: develop, study, software, programming
Published: 2022-01-03 11:59:21

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x9gx8ffd9eg3i0wevcj9.png)

As cited in [O'Reilly](https://www.oreilly.com/library/view/software-architects-handbook/9781788624060/8ff905c2-217a-47f0-85c2-789296d42e8d.xhtml) "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](https://garabedyan.wordpress.com/2009/05/14/lecture-on-design-patterns-refactoring-sane-principles-to-make-you-a-better-developer-dino-esposito/) 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](https://garabedyan.wordpress.com/2009/05/14/lecture-on-design-patterns-refactoring-sane-principles-to-make-you-a-better-developer-dino-esposito/)** 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](https://dev.to/suspir0n/o-que-e-srp-de-onde-vem-este-nome-5b68). 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z41ruls2tiyqxr6k38cr.jpg)

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 <b>Logbook #14</b>. 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.

<p align="center">
  <a href="#">
    <img src="https://cdn.dribbble.com/users/1889486/screenshots/5081642/thankyou_.gif" width="500">
  </a>
</p>


<b>This article was helpful to you?</b> 
<b>Leave a comment below.</b>

## References

* [Separation of Concerns (SoC)](https://www.oreilly.com/library/view/software-architects-handbook/9781788624060/8ff905c2-217a-47f0-85c2-789296d42e8d.xhtml)
* [Lecture on Design Patterns, Refactoring, Sane Principles to make you a better developer by Dino Esposito](https://garabedyan.wordpress.com/2009/05/14/lecture-on-design-patterns-refactoring-sane-principles-to-make-you-a-better-developer-dino-esposito/)