Mea Culpa: AFC Ain't So Bad

Microsoft's Java class library is actually more robust than Netscape's. And it really is cross-platform.

All products featured on WIRED are independently selected by our editors. However, we may receive compensation from retailers and/or from purchases of products through these links.

Last month, I wrote a column about the competing Java application class libraries from Microsoft and Netscape. The gist of the column was that Netscape was pushing in one direction with its Internet Foundation Classes while Microsoft was going in another direction with its Application Foundation Classes. The result, I predicted, was that soon Java would lose its promise of being a write-once, run-anywhere language.

At the time that I was writing the column, Microsoft was being pretty tight-lipped about what it was doing with AFC. But I have since spent an afternoon in Redmond, visiting with Kate Seekings, the AFC program manager, and David Sobeski, one of the programmers working on the AFC project, and I've got to admit that I walked away impressed.

For starters, contrary to the impression that I gave in my previous column, AFC is written entirely in the Java programming language. This means that it really will run anywhere - you just need some way of getting Microsoft's AFC classes into your Java Virtual Machine. Microsoft will be shipping AFC with Internet Explorer 4.0 for Windows 95. On other platforms, users can install the classes by hand, or simply have them downloaded on the fly each time an AFC application is run. Like Netscape with IFC, Microsoft is making the compiled AFC classes freely available.

The one key difference between Microsoft's AFC and Netscape's IFC is that the AFC classes are really nothing more than a few dozen components that fit neatly into the Abstract Window Toolkit (AWT) that's already part of the Java language specification. It's pretty easy to mix AWT and AFC components in the same program, which should make it easy for today's Java programmers to start folding in the new Microsoft objects without having to redesign their entire application user interface. IFC, on the other hand, is largely a clone of the NeXTSTEP AppKit. It's better in many ways, but the fact remains that it's fundamentally new. As Apple demonstrated back in 1984, "better" isn't always enough to overcome the problems associated with "new."

But what's really impressive about AFC is the richness of the classes that the folks in Redmond have developed. I have to admit it: There's more to AFC than to IFC. There's a new (and better) scroller, slidebars, a file-system explorer, a tree control, a tab display, support for incremental searching, accessibility support for screen readers, and the ability to navigate an entire graphical user interface using the keyboard. Many of the controls "hot track," which means they light up when you mouse over them. This feels like a class library that's received more institutional support.

"It's fun to be able to write real apps again," Sobeski told me. "With Java 1.0 and Java 1.0.2, what I did was write little applets that twirled text around, and a lot of really boring other things. To me that's not exciting." With the AFC classes, Sobeski said that he could create an application that people might actually want to use.

Of course, the story doesn't end there. Like other Java vendors, Microsoft is hard at work developing a tool that will compile Java into native code. This should let Java run as fast as C++. Even better, it will make the resulting code harder to decompile, which should help companies keep their trade secrets secret. Of course, programs that are compiled to native code won't run on any platform other than Win32. But a lot of companies will happily forsake portability if it means they can have increased speed and intellectual-property protection. A large bank developing an internal custom application might not care if this particular version of their application won't run on Oracle's Network Computer. After all, they probably don't have any. And if the bank does one day buy a few dozen NCs, they can simply recompile their app for Java bytecode.

For me, the most impressive part of my demonstration was seeing Microsoft's Internet Explorer rewritten in Java as 130 or so lines of code. What makes this possible is AFC's ability to incorporate ActiveX controls directly into Java applications. It's a little-known fact that Internet Explorer is actually a collection of software components - one for the toolbar, one for the history mechanism, one for the hot list, and so on. All of these components send messages to the HTML viewer, which is itself yet another component. (It's this component that America Online has licensed from Microsoft for the new AOL Web browser.)

Unlike Netscape, Microsoft has no plans to make the AFC source code available. Instead, Microsoft says that it plans to have enough documentation and support for the product so that developers don't have to turn to the source in order to answer their questions. Whether or not Microsoft is able to do this remains to be seen.

"The response to AFC has been incredibly positive," say my contacts at Microsoft. "They say this is a modern, commercial-quality set of classes."

Stepping back from the battle between Microsoft and Netscape, I must say that I was quite impressed by the AFC classes. It almost made me want to take a break from writing and start programming again.