![]() |
TRESE Aspects and advanced separation of concerns homepage |
One of the most important principles in software engineering is the separation of concerns principle [3]. This principle states that a given problem involves different kinds of concerns, which should be identified and separated to cope with complexity and to achieve the required engineering quality factors such as adaptability, maintainability, extendibility and reusability.
The principle can be applied in various ways. For example, separation of phases in the engineering process can be seen as a separation of engineering activities in time and goal. Defining sub-systems, objects and components may be seen as realizations of separation of concern principle in software. We can give many more examples and correspondingly, it is no exaggeration to state that the separation of concerns principle is an ubiquitous software engineering principle.
R-> S
whereby R represents the requirements, S the solution and the arrow -> represents the transformation process. For example, for the design of a distributed system the requirements R may be the preservation of consistency under the presence of failures. The solution S may be represented by a failure recovery protocol.
It is generally assumed that the requirements R include the specification of the relevant problems. In practice, however, finding the right problems and expressing these in the right way is not a trivial task. To simplify this, it is worthwhile to provide an intermediary phase in which the relevant problems are abstracted using the initial requirement specifications:
R-> P -> S
Hereby, P represents the actual problem for which a software solution is sought. In the example of failure recovery, P may represent the problem of designing a transparent failure recovery algorithm.
Let us now consider the solution model S in more detail. Basically, we can define S as a set of abstractions and relations that fulfills a specific role.
S = (SA, SR)
Hereby SA represents the set of abstractions (sa1, sa2, sa3, .. ,sa
n) and R represents the set of relations among these abstractions (sr1, sr2, sr3, .. ,srm). In theory, for a given problem P, numerous solutions may be possible. The quality of individual solutions is proportional to the degree in which they meet the following properties:The solution S is required to meet the goal and constraints of the problem P. That is to say, S should be relevant, and as such is valid for the context as defined by P.
The solution S should include necessary and sufficient abstractions to provide a relevant solution. Further, it should not include irrelevant and/or redundant abstractions. In other words, S should be generic and succinct, that is, canonical.
The relevance property ensures that the right solution is searched for the right problem. The canonical form property inherently reduces unnecessary complexity.
Given this model of software development we define a concern as follows:
Concern
A canonical solution abstraction that is relevant for a given problem.
Note that this definition implies that the concerns are not absolute but relative with respect to the considered problem. What may be a concern for one problem may not be a concern at all for another problem.
Since a concern is defined as a generic abstraction this means that it represents a set of possible instances of that concern. This implies that we can derive different alternatives from the given solution model. To explicitly reason about the set of alternatives of a solution model we present the following set of definitions [5][6]:
Figure 1.
A visualization of a three-dimensional design space for a solution abstraction SA = (sa1,
sa2, sa3)
Design SpaceDimensions
Orthogonal representations of concerns spanning a design space of a solution
abstraction. A dimension includes a set of alternative elements.
Coordinate
An element of a dimension representing an alternative instantiation of the concern.
Alternative
A composition of a selection of instances of concerns in a solution model.
Alternatives are represented as points in the design space. A point is a set of coordinate
elements of the individual dimensions.
Figure 1 provides, for example, a visualization of a three-dimensional design space that represents the solution abstraction SA = (sa1, sa2, sa3).
| Represent concerns as first-class entities | |
| Provide compositional operators |
The first class property means that the expressed concerns can be represented and manipulated individually. The language must provide a set of operators to compose the first-class entities. Let us explain these two requirements in more detail.
The first-class property of the concerns helps to increase the quality factors by localizing and expressing concerns separately. This means that given the set of solution abstractions as defined by SA = (sa1, sa2, sa3, .. ,san), we can define an abstraction model IA in a language such that:
IA = (ia1, ia2, ia3, .. ,ia
n)where there is a bijective mapping from SA to IA, that is, every abstraction in SA, can be separately represented by an abstraction in IA. Similar kind of mappings may be required for the set of semantic relations as defined by IR.
These requirements together lead to an implementation model I = (IA, IR), that forms an isomorphic model of the solution abstraction. We denote such a case in which the structure of the concerns in the solution model is preserved a structure-preserving transformation.
For every individual technical problem an ideal solution can be generated that requires a specific language in which all the concerns can be easily represented and the structure is optimally preserved. In practice, however, there is a huge set of technical problems that require different solution models with different concerns. Given the restricted time and resources of software projects, however, this is generally not a viable option and usually an existing and often a general-purpose language is used instead.
For a given problem, some languages are better in separating the concerns, and as such better in preserving the structure of the solution model, while other languages are less effective in this matter. In case the language is not expressive enough to either (1) represent the concerns separately and/or (2) provide the appropriate composition operators we say that the transformation from the solution model to the implementation model is anomalous and we denote this situation as a separation of concerns anomaly:
| Non-Separable Concerns |
The concerns of the problem cannot be represented as
first-class entities in the adopted language. Hereby, the original concerns of the
solution model are scattered over many implementation concerns. This scattering is usually
called cross-cutting [4].
The cross-cutting concern itself is defined as an aspect.
We may represent this as follows: sai -> {iaj, iak, ial,
}, where the concern sai in the solution domain model is represented
over more that one first-class entities {iaj, iak, ial,
}.
| Lack of suitable composition operators |
(See for example the E-tutorial "Evolution problems in object-oriented modeling": in powerpoint (1174KB), in zipped (340KB) or pdf format (1048KB))The composition operators as defined by the language cannot appropriately compose the first-class entities that represent the separated concerns. We term this as a composition anomaly [1] [2].
Assume for example, that sa3 = sa2 + sa1 where the concerns sa1 and sa2 are composed together and yield the solution abstraction sa3 using the composition operator + . There will be a composition anomaly if we cannot define a composition operator in the implementation language to realize ia3 = ia2 + ia1.
The following research activities explicitly address the separation of concerns problems:
| Composition
filters; | |
| Aspect-oriented
programming and AspectJ (Gregor Kiczales); | |
| The Demeter project (Karl Lieberherr); | |
| Multi-dimensional separation of concerns (Harold Ossher and Peri Tarr). |
![]()
An historical perspective to our research activities can be found here.
Our publications on aspects and advanced separation of concerns can be found here.
L. Bergmans, B. Tekinerdogan, M. Glandrup & M. Aksit, On Composing Software from Multiple Concerns: Composability and Composition Anomalies. Dept. of Computer Science, Univ. of Twente, The Netherlands, submitted, August 2000.
E.W. Dijkstra, A Discipline of Programming. Prentice Hall, Englewood Cliffs, NJ, 1976.
G. Kiczales, J. Lamping, A. Mendhekar, C. Maeda, C. Lopes, J.-M. Loingtier, J. Irwin, Aspect-Oriented Programming. In proceedings of ECOOP '97, Springer-Verlag LNCS 1241. June 1997.
B.Tekinerdogan & M. Aksit, Deriving design aspects from conceptual models. In: Demeyer, S., & Bosch, J. (eds.), Object-Oriented Technology, ECOOP '98 Workshop Reader, LNCS 1543, Springer-Verlag, pp.410-414,1999.
This page was last modified by Mehmet Aksit on December 25, 2000.
![]()