CS 541 Meeting -*- Outline -*- for Java * Characteristics of AOP: Quantification and Obliviousness reference: Robert E. Filman and Dnaiel P. Friedman, "Aspect-Oriented Programming is Quantification and Obliviousness", in "OOPSLA 2000 Workshop on Advanced Separation of Concerns", Minneapolis, MN, Oct, 2000, http://ic.arc.nasa.gov/~filman/text/oif/aop-is.pdf ** What features make an AOP language? ------------------------------------------ WHAT DISTINGUISHES AOP LANGUAGES (FROM OO, FUNCTIONAL, ETC.)? Filman and Friedman: AOP = quantification + oblivousness ------------------------------------------ *** quantification ------------------------------------------ QUANTIFICATION def: *quantified statements* have an effect on many places in the underlying code. e.g., - type declarations - code in superclasses - advice that applies to many calls ------------------------------------------ *** obliviousness ------------------------------------------ OBLIVIOUSNESS def: The *obliviousness of module M with respect to module A* is to the degree to which the programmer of M doesn't need to know about A low - M calls subroutines in A - M calls a dynamically bound method defined in A - M implements an abstract method in A - M is derived from multiple inheritance mixin A - M is advised by aspect A high ------------------------------------------ *** Summary Their definition: "AOP can be understood as the desire to make quantified statements about the behavior of programs, and to have these qualifications hold over programs written by oblivious programmers" (p. 2) ------------------------------------------ AOP SUMMARY Want to make statements of the form: In programs P, whenever condition C arises, perform action A. ------------------------------------------ Q: What part of this is quantification? Q: What does this have to do with obliviousness? Q: How does weaving fit in? We can also talk about the interface of actions, namely how they interact with base programs and with each other. *** What's not AOP ------------------------------------------ OPPOSITE OF AOP: UNITARY AND LOCAL unitary statements only affect one place local statements only affect neighboring statments ------------------------------------------ ** quantification *** static ------------------------------------------ STATIC QUANTIFICATION static quantification = quantification over the program text black-box AOP: quantification over public interfaces clear-box AOP: quantification over internal structures ------------------------------------------ Q: What kind does AspectJ have? clear-box Q: Do any of these require source code? clear-box Q: Which are more useful for debugging? clear-box Q: Which are more difficult to implement? clear-box black-box systems include composition filters, synchronization advice, and OIF *** dynamic ------------------------------------------ DYNAMIC QUANTIFICATION quantification over dynamic events during a program's execution - raising of an exception - call of a subroutine when some other call has taken place - when the call stack is a certain size - when a RPC has failed five times ------------------------------------------ This somewhat depends on the abstractions available in the programming language, e.g. call with current continuation in Scheme Another aspect of dynamism is whether one can give advice, etc. at runtime, or whether everything has to be fixed before runtime ** What's AOP? ------------------------------------------ IS IT AOP? rule-based systems (OPS-5, Prolog): event-based publish and subscribe: intentional programming and meta programming: generative programming: ------------------------------------------ ... yes ... if it's oblivious, then it's a black-box AOP mechanism. if the programmer has to put in event triggers, then not. ... only a mechanism for clear-box AOP ... not enough quantification or oblivousness Q: Is AOP always related to object-oriented programming? no, could be adapted to other paradigms ** summary more obliviousness equals better AOP