TOPICS FOR THE 541 TEST on Aspect-Oriented Programming Languages $Date: 2005/12/12 20:50:49 $ This exam covers topics from homework 5, including AspectJ and aspect-oriented programming. It also covers the language design ideas we have discussed throughout this semester, in a somewhat comprehensive way. You won't have to write programs in Haskell for this exam, but you may be required to do a bit of Scala programming (to compare Scala with AspectJ). REMINDERS The exam will be open book, open notes. (Warning: don't expect to learn the material during the exam, you won't have time! A good idea for studying is to condense your notes to a few pages of ready reference materials.) If you need more space, use the back of a page. Note when you do that on the front. This exam is timed. We will not grade your exam if you try to take more than the time allowed. Therefore, before you begin, please take a moment to look over the entire exam so that you can budget your time. Clarity is important; if your diagrams or programs are sloppy and hard to read, you will lose points. Correct syntax also makes a difference for programming questions. When you write AspectJ code on this test, you may use anything in the Java standard libraries, or in the packages org.aspectj.lang or org.aspectj.lang.reflect without writing it in your test. You are encouraged to define classes, interfaces, fields, and methods not specifically asked for if they are useful to your programming; if they are not in the standard libraries or the packages named above, please write them into your test. READINGS For AspectJ, primarily, you should read: - Ramnivas Laddad. AspectJ in Action: Practical Aspect-Oriented Programming. Manning, Greenwich, CT, 2003. (Especially chapters 1-4 and 8.) - The AspectJ(TM) Programming Guide (http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/progguide/index.html); - Gregor Kiczales, Erik Hilsdale, Jim Hugunin, Mik Kersten, Jeffrey Palm, and William G. Griswold, "An Overview of AspectJ," In J. Lindskov Knudsen (ed.), ECOOP 2001 --- Object-Oriented Programming 15th European Conference, Budapest Hungary, pages 327-353, Volume 2072 of Lecture Notes in Computer Science, Springer-Verlag, Berlin, June, 1997 (http://www.parc.com/research/csl/projects/aspectj/downloads/ECOOP2001-Overview.pdf); - Gregor Kiczales, Erik Hilsdale, Jim Hugunin, Mik Kersten, Jeffrey Palm, and William G. Griswold, Getting started with AspectJ, Communications of the ACM, Vol 44, num 10, pp. 59-65, Oct. 2001 (http://doi.acm.org/10.1145/383845.383858). If you have time, see the course web site and also the course syllabus for other readings. This might include the following: - Robert E. Filman and Daniel P. Friedman. Aspect-Oriented Programming is Quantification and Obliviousness. In Mehmet Aksit and Siobhan Clarke and Tzilla Elrad and Robert E. Filman, Aspect-Oriented Software Development, Addison-Wesley, Reading, MA, 2004. TOPICS In the following, I use + to denote relatively more important topics, and - to denote relatively less important topics. Topics marked with ++ are very likely to be on the exam. All of these are fair game, but if you have limited time, concentrate on the ones that are more important first (and in those, the ones you are most uncertain about). SKILLS + AspectJ programming; be able to: + give output of AspectJ code, especially for code that uses pointcuts and advice ++ write development aspects that advise existing Java code, [HW5: FibTracing, BlankLines, FibTiming, TraceBeta] (Fall'04: check for non-null args in calls to Line's constructor, check that when equals is called with null it returns false, check that equals returns false when called with different argument types--for types that subtype EqualsSameTypeOnly, Fall'03: TraceBeta, Fall'02: GetSumChecking, GetSumTiming) ++ write production aspects that advise existing Java code [HW5: FibMemo, BigStep's evaluate, eta reduction advice] (Fall'04: Optimize calls to equals to return true when this and argument are ==, Fall'03: BigStep's evaluate, eta reduction advice) ++ write aspects that introduce declarations into existing Java code [HW5: introduction of test method, boundVars method] (Fall'04: make types in geom implement EqualsSameTypeOnly interface) + write aspects that declare precedence ordering between aspects [HW5: FibTiming and BlankLines] (Fall'04: FixOrder to make EqualsNullEnforcer execute before EqualsSameTypeOptimizer) TERMS AND CONCEPTS You should be able to explain and use (in problems or essays) the following concepts (with appropriate comparisons to related concepts). You should be able to give examples of these concepts. + AOP design and general concepts + What is a cross-cutting concern? Give an example + What is scattering? Give an example. + What is tangling? Give an example. + How is AOP better than use of the observer pattern? ++ What kinds of AspectJ features replace the observer pattern and are useful for logging, debugging, etc.? ++ What kinds of AspectJ features are used to implement performance improvements, like caching, buffering, pooling, etc.? ++ Describe the advantages of a programming language approach, such as AspectJ, as opposed to approaches outside of a language, such as editing scripts. - How does AOP help deal with non-functional concerns? + How does AOP relate to OOP? - What uses are typical for AOP? + AspectJ semantics + Describe the meaning of AspectJ's identifier patterns. + Describe the meaning of AspectJ's type patterns. Say what types are matched by a pattern. + Describe the meaning of AspectJ's signature (method or constructor) patterns. Say what methods are matched by such a pattern. + What is a join point? What kinds of join points are dynamic in AspectJ? + Describe the meaning of each kind of AspectJ pointcut. (Fall'02: Why distinguish call vs. execution joinpoints?) + Be able to interpret or write code that declares pointcuts. (Fall'02: Pointcut that describes read or write access to any protected field, can one write pointcut for read or write access to any protected field that is not in a subclass?) + Explain how context exposure works in AspectJ. (args, this, target) [HW5 (extra credit): this and target in execution pointcuts, binding forms in advice] (Fall'04: Expressive power of the this pointcut, Fall'03: this and target in execution pointcuts, binding forms in advice) + How do you avoid advice that applies to itself? + What purpose do the formals in pointcut declarations serve in AspectJ? + What good are abstract point cuts? + What are the kinds of advice in AspectJ? + What are the best ways to use each kind of advice? + Describe the meaning of different kinds of advice. (Fall'02: Difference between different kinds of after advice) + What kinds of advice are sugars for other kinds of advice? How would you do the desugaring? [HW5: use before/after instead of around or vice versa] (Fall'03: Use before/after instead of around or vice versa) + What does proceed do? Where can it be used? + What use is thisJoinPoint, and thisJoinPointStaticPart? + What use is a privileged aspect? + What use is an abstract aspect? - What use are pertarget, perthis, etc? + Describe the kinds of behavioral changes that advice can make in AspectJ. - Type checking rules for AspectJ [HW5 (extra credit): type checking rules for arrayfetch joinpoint] (Fall'04: should changing exception be a type error?, Fall'03: type checking rules for arrayfetch joinpoint) + How can one use AspectJ to help glue independently developed libraries of code together? + What are the various kinds of static introductions in AspectJ? What do they do? (Fall'04: adding attributes to existing types) + How can one use AspectJ to enforce programming rules, such as layering of software? [HW5: rule that package b can't call a] (Fall'03: rule that package b can't call a) + What are the various kinds of "declare" declarations in AspectJ? What do they do? - How can one use AspectJ to change how exceptions are propagated or handled? + Explain the precedence concept in AspectJ. How does the "declare precedence" declaration work? When is it needed? + Consider some feature like one in AspectJ, and explain how it could be incorporated into an aspect-oriented version of Scala, Smalltalk, or Haskell (Fall'04: a use for around advice in Haskell, a use for around advice that would not work in Haskell) - AOP Semantics + What is quantification in aspect-oriented languages? Can you give examples from Scala, Smalltalk, or AspectJ? + What is obliviousness in aspect-oriented languages? Can you give examples from Scala, Smalltalk, or AspectJ? (Fall'03: give example of obliviousness in Smalltalk) + Why is obliviousness a good thing? + Give an example of a feature of Scala, Smalltalk, or Haskell that is definitely not aspect-oriented. + Is a logic programming language aspect oriented? An event-based publish and subscribe system where events are explicitly signaled? + What is dynamic quantification? Why is it useful? + What is modular reasoning? Why is it useful? + What reasoning principle helps deal with obliviousness due to dynamic dispatch in object-oriented programs? - What's the idea in the spectators and assistants paper? + Language design concepts and comparisons + What kind of programming tasks are Haskell, Scala, and AspectJ particularly good at? + What kinds of programming tasks does language X help with that would be very difficult to accomplish with language Y, where X, Y \in {Haskell, Scala, AspectJ}. [HW5: What tasks does AspectJ help that would be difficult in Scala?] + Compare the support for code reuse in languages X and Y, where X, Y \in {Haskell, Scala, AspectJ}. [HW5: Compare AspectJ's support for code reuse to that in Scala] + Compare support for code changes in Scala and AspectJ, especially in terms of maintenance. + What features of Haskell, Scala, or AspectJ would you like to include in the design of ``the next programming language.'' [HW5: What AspectJ features would you include?] + Explore combinations of features from Scala, AspectJ, and Haskell - What features of Haskell, Scala, or AspectJ would you omit from the design of ``the next programming language.'' [HW5 (extra credit): What AspectJ features would you omit?] - What features of Haskell, Scala, or AspectJ are difficult for the average programmer to understand and use on a daily basis? [HW5: (extra credit): What features of AspectJ would be difficult for the average programmer?]