Lably
Skip to content

Separation of concerns

Design principle for computer programming

  • 6 min read
  • 2 chapters

Related on Lably

Through Correctness (computer science), Internet protocol suite and Simple Mail Transfer Protocol

Separation of Concerns can be achieved in several ways: temporally (e.g., sequencing activities in a software lifecycle), by quality (e.g., treating correctness separately from efficiency ), by view (e.g., analyzing data flow separately from control flow) or by size (modularity)

Modularity is a specific application of concerns to system components (separation by size). In modular systems, each module encapsulates a single concern, and modules are designed, implemented, and understood in isolation before being composed into a larger system. While modularity is the most common and recognizable embodiment of SoC in code structure, the principle of Separation of concerns is broader. For example, separating requirements analysis from implementation in a project timeline, or separating functional from non-functional requirements in a specification, are valid forms of separation of concerns that do not necessarily require a modular design.

Edsger W. Dijkstra in his 1974 paper "On the Role of Scientific Thought", coined the term separation of concerns in relation to software qualities such as correctness and efficiency.

Carlo Ghezzi in his book "Fundamentals of software engineering" promotes Separation Of Concerns as the primary way to tackle the inherited complexity in software production.

Philippe Kruchten in his article "Architectural Blueprints—The “4+1” View Model of Software Architecture" used a model composed of five main views to address large architectures, essentially this is a view-based separation of concerns, where each view focuses on a different aspect of the architecture.

According to Carlo Ghezzi, the main benefit of software modularity is that it allows the application of the separation of concerns principle to system components, or "modules." Module details can be addressed in isolation; furthermore, module integration is treated as a separate concern that deals with the overall characteristics of software modules and their relationships.

Laplante, Phillip also mentioned that separation of concerns can be applied in software design, coding, time, and software qualities.

Origin

The term separation of concerns was probably coined by Edsger W. Dijkstra in his 1974 paper "On the role of scientific thought".

Let me try to explain to you, what to my taste is characteristic for all intelligent thinking. It is, that one is willing to study in depth an aspect of one's subject matter in isolation for the sake of its own consistency, all the time knowing that one is occupying oneself only with one of the aspects. We know that a program must be correct and we can study it from that viewpoint only; we also know that it should be efficient and we can study its efficiency on another day, so to speak. In another mood we may ask ourselves whether, and if so: why, the program is desirable. But nothing is gained—on the contrary!—by tackling these various aspects simultaneously. It is what I sometimes have called "the separation of concerns", which, even if not perfectly possible, is yet the only available technique for effective ordering of one's thoughts, that I know of. This is what I mean by "focusing one's attention upon some aspect": it does not mean ignoring the other aspects, it is just doing justice to the fact that from this aspect's point of view, the other is irrelevant. It is being one- and multiple-track minded simultaneously.

Fifteen years later, it was evident the term separation of concerns was becoming an accepted idea. In 1989, Chris Reade wrote a book titled Elements of Functional Programming that describes SoC:

The programmer is having to do several things at the same time, namely,

  1. describe what is to be computed;
  2. organise the computation sequencing into small steps;
  3. organise memory management during the computation.

Reade continues to say,

Ideally, the programmer should be able to concentrate on the first of the three tasks (describing what is to be computed) without being distracted by the other two, more administrative, tasks. Clearly, administration is important, but by separating it from the main task we are likely to get more reliable results and we can ease the programming problem by automating much of the administration.

SoC has other advantages. For example, program proving becomes much more feasible when details of sequencing and memory management are absent from the program. Furthermore, descriptions of what is to be computed should be free of such detailed step-by-step descriptions of how to do it, if they are to be evaluated with different machine architectures. Sequences of small changes to a data object held in a store may be an inappropriate description of how to compute something when a highly parallel machine is being used with thousands of processors distributed throughout the machine and local rather than global storage facilities.

Automating the administrative aspects means that the language implementor has to deal with them, but he/she has far more opportunity to make use of very different computation mechanisms with different machine architectures.

Sign in to keep reading

One more chapter is free with a Lably account.

More in Computing and communication