Computing

Untangling Code

  • 2/1/2001
  • By Claire Tristram

Gregor Kiczales

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.

Advertisement

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
Print

To comment, please sign in or register

Forgot my password

Advertisement

MAGAZINE

Can We Build Tomorrow's Breakthroughs?

Manufacturing in the United States is in trouble. That's bad news not just for the country's economy but for the future of innovation.

Sponsored Content

Technologies from National Instruments

Adding Data Logging
Log measured data to a file and open it in Microsoft Excel

> Click here for more National Instruments Videos <
Whitepaper

Temperature Measurements with Thermocouples: How-To Guide

This document is part of the “How-To Guide for Most Common Measurements” centralized resource portal. This tutorial provides a detailed guide for measurement and device considerations to take temperature measurements using thermocouples. Get an introduction to thermocouples, which are inexpensive sensing devices widely used with PC-based data acquisition systems. Also review some specific thermocouple examples and learn how thermocouples work and ways to integrate them into a data acquisition measurement system.

View full PDF > Listen to story >
Find us on Youtube

Videos

A Robot Recruit that Can Do It All

More

Advertisement

Technology Review Lists

TR50

Our list of the 50 most innovative companies, including the following:

Silver Spring Networks

Amyris

Serious Materials

Lattice Power

More

Advertisement

Facebook

Advertisement