separation_of_concerns

Separation of concerns

Snippet from Wikipedia: Separation of concerns

In computer science, separation of concerns (SoC) is the design principle of organizing a codebase into distinct sections – each addressing a single concern. SoC is the design principle that guides modular programming. A program that embodies SoC can be called a modular program. SoC/modularity is achieved by encapsulating logic and data inside a section of code that has a well-defined interface. Layered design (e.g., presentation, business logic, data access, persistence) and packaging by feature are other ways to achieve SoC.

SoC results in more degrees of freedom for some aspect of the program's design, deployment, or usage. Common among these is increased freedom for simplification and maintenance of code. When concerns are well-separated, there are more opportunities for module upgrade, reuse, and independent development. Hiding the implementation details of modules behind an interface enables improving or modifying a single concern's section of code without having to know the details of other sections and without having to make corresponding changes to those other sections. Modules can also expose different versions of an interface, which increases the freedom to upgrade a complex system in piecemeal fashion without interim loss of functionality.

SoC is a form of abstraction. As with most abstractions, separating concerns means adding additional code interfaces, generally creating more code to be executed. The extra code can result in higher computation costs in some cases, but in other cases also can lead to reuse of more optimized code. So despite the many benefits of well-separated concerns, there may be an associated execution penalty.

Achieving SoC can take many forms. For example, many object-oriented programming languages such as C#, C++, Delphi, and Java provide classes for SoC. Architectural design patterns like MVC or MVP can separate presentation and the data-processing (model) from content. Service-oriented design can separate concerns into services. C supports modularity at the file level. Aspect-oriented programming languages can separate concerns into aspects. Ruby provides partial classes for SoC.


Cloud Monk is Retired ( for now). Buddha with you. © 2025 and Beginningless Time - Present Moment - Three Times: The Buddhas or Fair Use. Disclaimers

SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.


separation_of_concerns.txt · Last modified: 2025/02/01 06:29 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki