Today was a great day!! My demonstration proposal was accepted at the first Aspect Oriented Software Development conference in the Netherlands![1] I will be demonstrating for the first time my implementation of Aspect-Oriented Programming (AOP) using the CLR. This will also be my first talk at a computer science academic conference. This is quite unlike my last stint in academia during my other life.
The AOP plumbing that I built for the CLR is quite novel. It relies on the metadata and profiling interfaces provided by the CLR’s execution engine to rewrite CIL code on the fly at JIT compilation time. Since all of the aspect weaving is done at JIT compilation time, I can weave system library code as well as user-defined code.
Aspect oriented programming is a way of dealing with software complexity.[2] The canonical examples of applications of AOP typically involve code that is scattered throughout an application. Some examples are:
- Tracing / logging
- Security access control checks
- Pre / post condition assertions (which could ultimately lead to an implementation of Eiffel’s Design-By-Contract semantics).
What AOP promises is the ability to gather all of this code and put it in a single place (the aspect). You do so by instructing your AOP runtime / framework to weave your aspect throughout your application. Here are some examples:
- “call the logMethodCall() method after any call to any method in the System.Xml namespace”
- “call the accessCheck() method instead of any call to a constructor in the System.IO namespace”
One of the great features of AOP is that the aspects can be introduced and removed very easily. You no longer have to modify your source code; you simply change the weave instructions to add or remove your aspects from your program. For example, you can easily turn on and off tracing at various points in the execution of your program simply by changing the weave instructions. What’s even more powerful is the ability of the CLR to force the re-JIT of an existing compiled method; this lets you weave and un-weave code without shutting down or restarting an application!
This is just one part of what I’ve been up to in my plan. My AOP engine for the CLR will serve as the technological foundation for a set of products that I will be producing later this year. Stay tuned to this weblog for more details on my AOP engine and AOP programming in general as I drive towards the first public unveiling[3] of this technology!
[1] http://trese.cs.utwente.nl/aosd2002/index.php
[2] In the words of Dijkstra, “I have a small mind and can only comprehend one thing at a time”.
[3] Attendees of the VS Live! conference February 13-15 in San Francisco might get a sneak preview of this code in action if I can hit my milestone 3 release criteria by then.