Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Tools

The AOP Report Card


The AOP Report Card

Software Development

As I discussed last month, to be widely adopted, programming paradigms must be expressive, efficient, intuitive, compatible, and have good tool support. How does the current state of aspect-oriented programming stack up to these criteria? Is this new paradigm destined for success? To find out, this month I examine three of the available AOP tools. (While I specifically mention only AspectJ, AspectWerkz and the JBoss AOP framework, my observations also apply to other AOP tools, such as AspectC++, JAC and Nanning.)

Expressiveness

A programming paradigm is expressive if it lets you write code that clearly indicates what you want it to do. Expressiveness comes from explicit support for good idioms of program structure. To enhance expressiveness, the new mechanisms should be compositional and support abstraction.

AOP mechanisms fare well on expressiveness. This stands out in numerous examples, including those I discussed in my first Crosscut column (“Testing the Waters,” Nov. 2003). Part two of Ramnivas Laddad’s AspectJ in Action (Manning, 2003) also has a nice collection of examples. In addition to capturing good elements of program structure, most AOP mechanisms support some degree of composition and abstraction. The critical new idea in AOP is the pointcut mechanism—pointcuts in AspectWerkz and AspectJ are compositional, and it’s possible to define them as named abstractions.

Advice is another key element of AOP tools (even if it isn’t new)—AspectWerkz and JBoss allow composition of advice. All three tools offer some form of composition and abstraction of introductions, and they also make it possible to handle aspects themselves as named abstractions.

The tools support different degrees of composition of aspects. The expressiveness of AOP mechanisms will no doubt improve, as exciting research is going on in this area. But existing AOP mechanisms already score well on expressiveness, which is the first criterion for a new paradigm to achieve widespread adoption.

Efficiency

Programmers won’t use a new paradigm unless it’s efficient. In general, new mechanisms must have efficiency comparable to hand code and should add overhead only when they’re used (pay as you go).

The efficiency of statically deployed AOP, as provided by AspectJ, is already quite good. It meets the pay-as-you-go criterion and is typically comparable to hand code.

The newer forms of dynamic AOP, as provided by AspectWerkz, JBoss AOP and other frameworks, are more difficult to optimize, but the dynamic tool developers are actively working to adapt the techniques for optimizing static AOP. There’s every indication that dynamic AOP will soon meet the comparable-to-hand-code criterion. In addition, at least one major player is beginning to evaluate the possibility of aspect weaving as part of the virtual machine itself, as an extension to the kinds of caching and just-in-time compiling the VM already does.

Because AOP’s semantics sometimes require whole program analysis, implementing AOP has caused the old issue of compiler speed to resurface. Several tool projects are examining fast incremental re-weaving in the face of the typical changes programmers make during development.

Intuitiveness

A programming paradigm is intuitive if, when you see the first examples of how it works, you naturally begin to understand it. AOP is similar to object-oriented programming (OOP) in this regard. Many developers, when they see good AOP code, find it easy to understand and see its benefits. But learning how to create good AOP code and gaining a feel for the various trade-offs involved can take some time.

AOP proponents must create training and support materials that will help developers quickly learn the power of the technology and how to use it in a range of applications.

With OOP, we saw an early boomlet in which some developers used OO languages but weren’t thinking objects—they still worked in a procedural style, using objects as data structures. Good training and support materials can help avoid similar pitfalls for AOP.

Compatibility

Most AOP frameworks score well on compatibility. Code written with AspectWerkz, AspectJ and JBoss AOP runs on standard Java VMs, which is essential for widespread adoption.

An open question remains as to whether AOP tools should extend the underlying language syntax. AspectJ extends Java syntax, providing a tight integration of AOP with the Java language. AspectWerkz and JBoss AOP use a separate XML-based language to specify aspect functionality, meaning there are no changes to Java. Whether extending the Java language or adding a new external language will ultimately prove more popular remains to be seen. I believe that integrating AOP tightly into the language is the better bet—that certainly was the case with OOP.

Tool Support

Good tool support is vital to widespread adoption of AOP. Structure browsers, online documentation and debuggers really help us to understand a large system written with aspects, just as they do a large system written with objects.


[click for larger image]

Crosscut Support
Eclipse support for AspectJ makes crosscutting structure explicit with editor annotations and structure view links.
Some good tool support is already available. The structure browsing support provided for AOP by Eclipse provides a tight integration of classic OOP browsing and AOP browsing, and lets developers easily see the structure of their code. But we need even more tool support. Over the last five years, the quality of development environments has improved dramatically. For developers to be satisfied, AOP support needs to be just as good as OOP support.

AOP proponents are hard at work in this area. AspectJ support is available for many IDEs, including Sun NetBeans, Borland JBuilder and Eclipse. IntelliJ has early-access support. Once a consensus emerges on how to represent crosscutting aspect structure, these IDE extensions should be able to support tools such as AspectWerkz, as well.

Sustaining the Second Wave

State-of-the-art AOP scores very well on expressivity and fairly well on efficiency and compatibility. These three criteria measure a new paradigm’s potential, some of its costs and ease of integration. Meeting these criteria is what gets a new paradigm out of the starting gate; indeed, this is what has led to so much interest in AOP. Developers see that it can simplify and improve their code, and that it has the potential to be efficient and easy to integrate with existing systems.

But we need more developer support material, including training, books, design guidelines, design notations, libraries and the like. In addition, we need expanded and enhanced tool support. The very first wave of adopters (the so-called bleeding edge) are more willing to do without this, but second-wave developers, who are still early adopters, need better training, support and tools. AOP proponents know that building such a foundation is a key challenge.

Next month: What does crosscutting mean, anyway?

Aspects Face to Face
The Third International Conference on Aspect-Oriented Software Development will be held in March in Lancaster, U.K., and will include tutorials on many of these tools as well as a wealth of other AOP information. See http://aosd.net/conference for details.


Gregor Kiczales led the Xerox PARC teams that developed aspect-oriented programming and AspectJ, and is a leading AOP evangelist based in Vancouver.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.