25 Dec 2015

Aspect oriented programming ECOOP

ECOOP'97 — Object-Oriented Programming
http://link.springer.com/chapter/10.1007/BFb0053381

2 background assumptions

… many existing programming languages, including object-oriented languages, procedural languages and functional languages, can be seen as having a common root in that their key abstraction and composition mechanisms are all rooted in some form of generalized procedure … … for the purpose of this paper we will refer to these as generalized-procedure (GP) languages

The design methods that have evolved to work with GP languages tend to break systems down into units of behavior or function. This style has been called functional decomposition [25-27]

The exact nature of the decomposition differs between the language paradigm of course, but each unit is encapsulated in a procedure/function/object, and in each case, it feels comfortable to talk about what is encapsulated as a functional unit of the overall system.

3. what are aspects

easy to understand but inefficient, efficient but difficult to understand, and an AOP-based implementation that is both easy to understand and efficient.

a black-and-white image processing system, in which the desired domain model is one of images passing through a series of filters to produce desired output

3.2 optimizing memory usage

excessively frequent memory references and storage allocation … leads to cache misses, page faults, and terrible performance

the familiar solution to the problem is to take a more global perspective of the program, map out what intermediate results end up being inputs to what other filters, and then code up a version of the program that fuses loops appropriately to implement the original functionality while creating as few intermediate images as possible

revising the code to make more efficient useof memory has destroyed the original clean component structure

implementation
the clean … 768 lines of code
the tangled implementation, which does the fusion optimization as well as memorization of intermediate results, compile-time memory allocation and specialized intermediate data-structures, is 35213 lines

small changes to the functionality require mentally untangling and re-tangling it

3.3 cross-cutting

... whenever two properties being progtrammed must compose differently and yet be coordinated ... they cross-cut each other. Because GP languages provide only one composition mechanism, the programmer must do the co-composition manually, leading to complexity and tangling in the code.

a component , if it can be cleanly encapsulated in a generalized procedure
(i.e., object, method, procedure) cleanly — well-localized, and easily accessed and composed as necessary. components tend to be units of the systems’s functional decomposition …
an aspect , if it can be cleanly encapsulated in a generalized procedure
aspects tend not to be units of the system’s functional decomposition, but rather *to be properties that affect the performance or semantics of the components and synchronization of concurrent objects* .

4. other examples of how aspects cross-cut components

the different dynamic contexts that can lead to a failure or that bear upon how a failure should be handled, cross-cut the functionality of systems