Applying Composition Filters to C

Author(s): Winkel, J.D. te (2006)

Abstract:
Aspect-oriented programming makes it possible to separate crosscutting concerns from the base program. It is an extension to the object-oriented programming paradigm, but crosscutting concerns are not an object-oriented problem. Such concerns are also seen in other programming languages, for instance in C. Bringing aspect-oriented programming to C is valuable, because C is still very popular and crosscutting concerns are troublesome. This is for example the case in the legacy system of ASML, where four major crosscutting concerns are responsible for approximately 31% of the 12 million lines of code in the system. At the moment there are a few aspect-oriented weavers for C. These weavers are all based on the AspectJ methodology. In this research an aspect-oriented weaver for C is developed with the Composition Filters approach. The main benefit that composition filters offer over the AspectJ approach is that it supports a declarative way for specifying advice by use of a filter. For implementing a weaver, first a mapping from composition filters to C is developed. This is not easy, because composition filters are an extension to the object-based paradigm, and it uses some language constructs from this paradigm which do not exist in C. Key elements in composition filters are: a message, a filter, and a superimposition unit. In order to create a weaver for C, these elements need to be defined in C. After the mapping is created, Compose C is presented, which is an extension of the current implementation of composition filters named Compose. Extending Compose was possible, because a large part of its design and implementation is language independent which means that it could be reused. Components that are not language independent are: the code-weaver, the language model, the collecting of program-information, the filters, and IDE support. Therefore these components had to be developed by ourselves, except for the code-weaver for which an existing weaver is selected.

Document(s):

Scriptie_te_Winkel.pdf