mail
this article to a friend.
January/February 2001
Go to list of links
The Technology Review Ten: Untangling
Code
Brain-Machine Interfaces
� Flexible Transistors � Data
Mining � Digital Rights Management
� Biometrics � Natural
Language Processing � Microphotonics
� Untangling Code � Robot
Design � Microfluidics
By Claire Tristram
Gregor Kiczales
|
Photography
by Mark Gilbert
|
Pity software engineers. With the touch of a button, their programs
let us make global fixes in a long text, say, or a spreadsheet, yet
programmers often need to correct their own work one tedious line at
a time. That irony isn't lost on Gregor Kiczales, principal scientist
at Xerox's Palo Alto Research Center (PARC) and professor at the University
of British Columbia in Vancouver—and he has a fix in mind. Kiczales
champions what he calls "aspect-oriented programming," a technique that
will allow software writers to make the same kinds of shortcuts that
those of us in other professions have been making for years.
One such "crosscutting" capability is logging—the ability to
trace and record every operation the application performs. Since any
given command might touch down on functionally unrelated areas of the
code, programmers now must make a rule, such as: "When adding a new
function to this application, always put a trace statement in." Of course,
the rule works only if people remember to follow it.
Other crosscutting capabilities include security and synchronization—the
ability to make sure that two users don't try to access the same data
at the same time. Both require programmers to write the same functionality
into many different areas of the application. Even a modest-sized application
can easily present 100 crosscutting issues.
Programmers try to track these instances of repetition, so that when
a capability needs to be changed or upgraded, it can be done uniformly
throughout the program. But keeping track of crosscutting concerns is
an error-prone process. Forget to upgrade just a few of these instances,
and your code starts collecting bugs. "We're forced to keep track of
everything in our heads," says Kiczales.
Kiczales' proposed solution is to create a new category within a programming
language called an "aspect." Aspects allow programmers to write, view
and edit a crosscutting concern as a separate entity. Once the programmer
is happy with it, a single keystroke will weave the aspect into the
code wherever it is needed. It's a smart, intuitive, neat solution to
an old problem. And what's good for programmers is good for the rest
of us: Widespread adoption of aspects holds out the promise of less
buggy upgrades, shorter product cycles and, ultimately, better and less
expensive software.
The idea of aspects has been around for many years and with many different
names. It's called "adaptive programming" at Northeastern University,
"subjective programming" at IBM, "composition filtering" at the University
of Twente in the Netherlands and "multidimensional separation of concerns"
elsewhere. But unlike these other research projects, Kiczales and his
team at PARC have taken the concept out of the lab and into the real
world by incorporating the idea of aspects into a new extension of the
programming language Java. The beta version of this extension (called
AspectJ) is available for free at www.aspectj.org, and Kiczales plans
to make release 1.0 ready by June. "Major changes in programming methodology
can take 30 years to gain widespread acceptance," he says. Making aspects
an extension to an existing standard should, he predicts, "cut the cycle
by 15 or 20 years."
While Kiczales admits the tools are still a little raw, there are
nevertheless about 500 users of AspectJ today—most of them finding
existing tools inadequate for creating long, complicated programs in
Java. Some have already found AspectJ so solid that they've used it
in production. One of these is Checkfree.com, a company that makes software
for automatic bill payment. Checkfree sells both C++ and Java versions
of the software. Rich Price, senior engineer, estimates that AspectJ
allowed his team to implement an important crosscutting capability in
the Java version in four programmer-hours, whereas the C++ team, with
no aspect-oriented programming tools at their disposal, took two programmer-weeks
to do the same thing. Using aspects, he says, "I make one change, in
one place, and it gets woven in where it needs to be. I love that."
By folding their ideas into a practical Java extension, Kiczales and
his team hope to make aspects part of the vernacular of programming
languages. "AspectJ lets programmers work more quickly and at a higher
design level," says Kiczales. "We've learned that crosscutting concerns
are actually not hard to work with—once you have the proper programming
support."
Others Untangling Code
Organization |
Project |
Mehmet Aksit (University of Twente, the
Netherlands)
|
Composition filters |
Karl Lieberherr (Northeastern University)
|
Adaptive programming |
IBM Research (Yorktown Heights, N.Y.)
|
HyperJ system for Java programming |
Mira Mezini (Univ. of Siegen, Germany)
|
Enhancing modularity and reusability of A-O software
|
Claire Tristam is Technology Review's West
Coast Bureau Chief.
This article has an online
forum. Join us for a discussion!
Feedback
Tell us what you think about this article—send your comments
to letters@technologyreview.com.
Please include your city and telephone number. Letters may be edited
for clarity and length.
Links
mail
this article to a friend.
Printable version of this article
Participate in the online
forum.
Other TR 10 articles in this issue:
Brain-Machine Interfaces � Flexible
Transistors � Data Mining � Digital
Rights Management � Biometrics �
Natural Language Processing � Microphotonics
� Untangling Code � Robot
Design � Microfluidics
Return to Articles Online Main Page