Section 9.1. INTRODUCTION


9.1. INTRODUCTION

Aspect-oriented programming (AOP) is concerned with providing programmatic means to modularize crosscutting functionalities of complex applications. By encapsulating such functionalities into aspects, AOP facilitates development, understanding, and maintenance of programs. An important characteristic of aspects is that they are built from crosscuts (pointcuts), which define where an aspect modifies an application, and inserts (advice), which define the modifications to be applied. Typically, crosscuts denote sets of program points or execution points of the base application, and inserts are expressed in a traditional programming language. For instance, an aspect for access control could be defined in terms of crosscuts denoting sets of access methods and inserts performing the access control tests. However, because aspect languages are rather limited, it is often necessary to use inserts to pass information from one crosscut to another. Consider, for example, an aspect performing some access control for logged-in users. An aspect language that cannot refer to the historical login event must use an extra insert to set a flag in the login code and must write the access control aspect to recognize this flag.

Conventional aspect languages allow unrestricted inserts; the role of inserts overlaps with that of crosscuts. This makes reasoning on aspects and woven programs difficult. In this chapter, we present an approach that uses expressive aspect languages and restrictions on inserts to enable reasoning about different aspect properties.

Trace-based aspects are defined on traces of events occurring during program execution. Trace-based aspects are more expressive than those based on atomic points because they can express relations between execution events, including those involving information from the corresponding execution states. For example, an aspect for access control could express that a user has to log in first in order to pass an access check later. Such aspects are called stateful: Their implementation must use some kind of state to represent their evolution according to the event encountered. Conceptually, weaving is modeled by an execution monitor, whose state evolves according the history of program execution and that, in case of a match, triggers the execution of the corresponding action. By strictly separating crosscuts and inserts by means of two different, well-defined languages, we address the formalization of aspects and weaving. Restrictions on these languages allow us to design static analysis of aspect properties as well as an optimized implementation of aspect weaving.

In Section 9.2, we informally introduce the main features of trace-based AOP: observable execution traces, stateful aspects (composed of crosscuts and inserts), and weaving (based on execution monitoring). In Sections 9.3 through 9.5, we explore three different options within the trade-off between expressiveness and property enforcement/analysis. The first provides an expressive crosscut language with no restrictions on the inserts. However, the expressive power of this option precludes automatic proofs of most aspect properties. The second option is characterized by more restricted, but still stateful, aspects corresponding to regular expressions over execution traces. Because of this restriction, it is possible to statically detect whether several aspects interact (e.g., testing whether an encryption aspect interacts with a system logging aspect). We also suggest operators for the resolution of such interactions. The last option is characterized by a very restricted insert language where aspects can be seen as formal safety properties. We present how these aspects/properties can be statically and efficiently woven. An application of this technique is the securing of mobile code upon receipt. Finally, we discuss related work and conclude in Section 9.6.

This chapter is a unified presentation of three distinct studies: [3], [7] (which has recently been extended in [8]), and [9]. These studies share a trace-based approach to AOP. To make the presentation more intuitive, we have deliberately omitted many extensions and technical details.



Aspect-Oriented Software Development
Aspect-Oriented Software Development with Use Cases
ISBN: 0321268881
EAN: 2147483647
Year: 2003
Pages: 307

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net