A Temporal Logic Language for Context Awareness in Pointcuts

A paper by Charlotte Herzeel, Kris Gybels, Pascal Costanza presented at ILC2007.

Some program concerns cannot be cleanly modularized, and their implementation leads to code that is both hard to understand and maintain. In this paper we consider extending an e-commerce application, written in CLOS, with two of such crosscutting concerns. Though most of the time Common Lisp's macro facilities and CLOS method combinations can be used to modularize crosscuts, we discuss the use of a more declarative solution when crosscuts depend on the execution history. For this purpose we give an overview of HALO, a novel pointcut language based on logic meta programming and temporal logic, which allows one to reason about program execution and (past) program state.

Charlotte Herzeel presented this at ILC with a flashy web-shop application built on Edi Weitz's standard tools of the web trade. The example takes the basic web-shop and uses aspects to add a lot of funky rules about promotion and discounts based on stock levels, what's selling well, what the user has been browsing, etc, and makes sure the discounts are honoured at the checkout.

The focus on adding new and interesting functionality with aspects is refreshing. So is the basis in a powerful language like Lisp. The weakness of most aspect-oriented programming examples in my eyes is that they appear to be working around artificial problems caused by stubbornly using a base language that's ill-suited to the task. That only plays well with the audiences who are also stubbornly using those base languages for ill-suited tasks :-)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

The weakness of most AOP examples

The weakness of most aspect-oriented programming examples in my eyes is that they appear to be working around artificial problems caused by stubbornly using a base language that's ill-suited to the task. That only plays well with the audiences who are also stubbornly using those base languages for ill-suited tasks :-)

This reminded me of a moment at ILC 2003, which Kenny Tilton described as follows:

I am reminded of Gregor Kiczales at ILC 2003 [the International Lisp
Conference] displaying some AspectJ to a silent crowd, pausing, then
plaintively adding, "When I show that to Java programmers they stand
up and cheer."

AOP's success in the Java camp

It's no wonder that the Java crowd likes AOP so much. In Java, you neither have macros, nor higher-order functions nor a serious reflective and/or metaobject API. In other words, there are no (convenient) ways to do metaprogramming, except for some mild versions thereof in java.lang.reflect, or the cumbersome ways via inner classes, or if you dare to do this, via hacking around with custom class loaders. (Ah yes, together with annotations, Sun has also introduced some tools to do program transformation...)

Compared to those options, tools like AspectJ, Spring AOP, and so on, are a breeze. (And due to clever marketing, the Java people don't even realize that they are using a (limited) subset of metaprogramming techniques here.)

It's interesting to note that in C#/.NET world, AOP hasn't caught on. I suspect that this is due to the inclusion of first-class methods from the start.

Lispers and Schemers are, in general, not impressed by AOP because macros, higher-order functions and, in CLOS, a full-fledged metaobject protocol make metaprogramming very convenient and, after an admittedly steep learning curve, very straightforward.

At the Programming Technology Lab at the VU Brussels in Belgium, where the above research has been undertaken (mostly by Charlotte and Kris), there is a tradition of using logic programming languages for expressing metaprograms. This makes some meta-level idioms very compact and intuitive. What Charlotte has added is a set of temporal logic operators to logic metaprogramming which enables reasoning about the execution history of a program. This goes beyond simple before/after/around advice and even beyond cflow-style aspects, and therefore makes this research interesting for Lisp and Scheme (and hopefully other higher-order languages) as well.