January 14, 2005

Exploring the deep structure of code

Move over, text editors; here comes a new programming paradigm

It’s been a while since I’ve written code in Java. This week, however, I updated my installation of Eclipse, dusted off an old Java program, and saw that ancient artifact in a whole new way.

Now, I’ve never been an IDE kind of guy. It’s always been Emacs for me, and in InfoWorld circles, I’m not alone in that preference. Both Chad Dickerson and Maggie Biggs have also made the case for the no-frills approach. At the end of the day, programming still comes down to pushing lines of code around in text files, and until we change that paradigm, code editors built to push lines of code around in text files are going to be hard to beat.

Eclipse 3.0 doesn’t complete the paradigm shift, but its powerful refactoring tools hint at things to come. For starters, the ability to rename a method globally, across all of a project’s Java files as well as its unit tests, is convenient. Yet, that’s really just a fancy search-and-replace. More impressive is the ability to restructure code. Eclipse can, for example, convert a code fragment into a method and a call to that method, or it can promote and demote class members within a class hierarchy.

This transformational magic requires some actual analysis of the code. Under the covers, Eclipse maintains an AST (abstract syntax tree) — the deep structure (as linguist Noam Chomsky would say) that underlies the surface structure that we write, read, and edit as lines of Java code. With Eclipse, you begin to get the feeling that you’re working directly with the AST and that the Java text is only a convenient way to visualize it.

It’s still only an illusion, though. When you check your project back into the repository, you’re checking in lines of code, not an AST. The refactoring that you did will be visible to the rest of the project team as line-oriented diffs, not as tree transformations.

At one time or another, every programmer has imagined what it would be like to work directly with the deep structure of code. Some of the best minds in the business are working to make that happen. The legendary Charles Simonyi, who left Microsoft a couple of years ago to pursue his vision of “intentional programming,” says deep structure is at the core of the toolset that his new company, Intentional Software, is building. Sergey Dmitriev shares Simonyi’s vision, and his company — JetBrains, creator of the IntelliJ IDEA Java IDE — wants to do something similar with its next-generation toolset.

These projects are still under wraps, but another champion of deep structure is working out in the open. Jonathan Edwards, currently a visiting engineer with the Massachusetts Institute of Technology’s Software Design Group, has built a prototype system that he is demonstrating in a screencast.

There are big ideas at work here. In Edwards’ prototype, programming, testing, and debugging are just different ways of interacting with a program’s tree structure. Edwards’ 2004 OOPSLA paper, “Example Centric Programming ”, explores one of the benefits of this arrangement: The examples — or “use cases” — that drive program design are worked out in the context of the living and evolving program.

We’ve all heard stuff like this before. I may yet go to my grave without Emacs ever having been pried from my cold dead fingers. It’s worth pondering, now and then, though, what we could do with tools that didn’t think of programs as strings of text.

Close

On Twitter now

Application development

Powered by Twitter

White Paper

D2D Virtual Tape Library Replication Primer

This whitepaper explains the terminology and concepts behind Data Replication technologies and establishes some sizing rules through worked examples. Learn the new paradigm in disaster tolerance—protect data anywhere.

Download now »

White Paper

An Alternative to Virtualization for Datacenter Cost Savings

Server virtualization is a popular option for dealing with mounting datacenter costs. Another equally promising approach is the use of an Application Delivery Controller. Citrix NetScaler provides a low-cost way for organizations to reduce their server count and accrue cost savings from a reduction in space, cooling, power and personnel.

Download now »

White Paper

Why Your Firewall, VPN, and IEEE 802.11i Aren't Enough to Protect Your Network

The emergence of WLANs has created a new breed of security threats to enterprise networks.

Included in HP ProCurve WLAN solutions is security technology that alleviates threats from WLANs through:
* Monitoring wireless activity inside and out of the enterprise
* Classifying WLAN transmissions into harmful and harmless
* Preventing transmissions that pose a security threat to the enterprise network
* Locating participating devices for physical remediation

Download now »

White Paper

Bringing the Edge to the Data Center

Effectively address data protection challenges, implementing solutions that help store and protect business–critical data while cutting costs and improving efficiency and reliability.

Download now »

Sign up to receive InfoWorld Resource Alerts

Subscribe to the Developer World Newsletter

Receive a weekly roundup about the art and science of software development.

©1994-2009 Infoworld, Inc.