Since the introduction of Java and Sun's Java Development Kit over nine months ago, Mac users have been left out in the cold waiting for their turn to get the slick GUI development environments. Sun finally came out with the JDK for the Mac, and now Metrowerks, whose CodeWarrior development environment has dominated the Macintosh programming tool market, has extended its reach to include Java with the recent release of CodeWarrior Gold 9. In this issue the Java Developer's Journal will take a look at CodeWarrior Gold 9 and let you know how it stacks up.
CodeWarrior Gold is Metrowerks' professional bundle, providing an extensive development environment with several languages (C, C++, Object Pascal, Java) and target platforms (Mac, Windows, BeBox, MagicCap). With the Gold package, you get a QuickStart manual, and 2 CD-ROM's: one containing the tool set and the other containing documentation and examples. Documentation is generally provided in both eDOC and Acrobat formats, with readers provided. A full installation of the CodeWarrior Gold tool set would require almost 240Mbytes of disk space! With a development environment this complex, it would be easy for a first-time user to get lost; Metrowerks provides a Java-specific document on the second CD that explains how to use the various tools from a Java perspective. This document is a good starting point for someone new to CodeWarrior. Ignoring the many other aspects of CodeWarrior Gold, this review covers only Java development.
The documentation identified the Java support as Beta. However, the parts of CodeWarrior that are not Java-specific (such as project management and editing) are solid. CodeWarrior 9 appears to be based on JavaSoft's JDK 1.0.1 (as indicated by the appletviewer properties).
The Java-only environment created using the installer only occupies about 13MByte of disk space; this figure does not include API documentation or sample code. CodeWarrior Gold 9 provides Java support for PowerPC as well as 68K Macs; in fact, this version of CodeWarrior works fine even on old 68030 machines. CodeWarrior works using the, now common, project-centric approach. When creating a new project, you can select from a variety of predefined stationary that automatically configures many of the per-project preferences. For each file in the project, the project window indicates if the file needs to be compiled, its code size, and if debugging information is generated. You can mix Java and non-Java files in the project to keep track of all files related to a project; CodeWarrior only attempts to compile the files containing Java as indicated by file extension or type. Of course, CodeWarrior keeps track of the status of your source files and only compiles the files that are out-of-date. You can manually trigger a recompile from the project window.
A project can be one of four types: the usual "class folder" where the .class files for the applet are placed in a separate folder; a ".zip" where CodeWarrior automatically builds a single Java-compatible .zip library file of your classes; a "runnable .zip"; or a "droplet." These last two project types give CodeWarrior a unique advantage when developing Java applications. For a "runnable .zip", CodeWarrior embeds the .zip library file into a dummy application that, in turn, invokes the Java virtual machine when launched. A "droplet" extends this concept further to allow you to build a drag-and-drop Java application where the name of the "dropped" file is automatically provided as the first parameter to main().
CodeWarrior Gold does not provide any facilities for source code control. An optional source-code control application is available.
CodeWarrior provides a fairly standard source code editor that can color comments, keywords and strings differently, but does not provide a reformatting function nor tools for inserting templates for class, method or HTML definitions. The editor does provide support for both horizontal and vertical window "panes" and a quick navigation pop-up menu to move to a given function declaration. The editor, if not notable, is solid.
CodeWarrior incorporates several different styles of browsers to help the user navigate through their various source files. You can display a "catalog" of items, such as methods and classes, from the project. The catalog window provides a quick way to view a listing of all classes or functions in the current project; however, the method display window is a bit crowded since it gives the fully quantified declaration for a function, and it didn't identify as "constants" the Java convention of final static declarations. The multi-class browser provides the next level of detail; it shows the class hierarchy, method definitions, local variables, and a lower window pane for editing. A detailed, single-class browser can be invoked from the class display in the catalog. This browser window shows the "bases" of the class, that is the classes it extends or implements; a listing of methods, a listing of instance variables and the source code related to the select method or variable; you can also edit this source code directly in this lower window pane.
Though they provide adequate functionality, these separate browser modes seems somewhat clumsy when compared to the class browsing offered by other environments.
Metrowerks merged several of JavaSoft's Java runtime programs into a single application called "Metrowerks Java." This application can function as an applet viewer, an application runner, a Java compiler (the standard JavaSoft reference version), class dumper, and header file generator. Because JavaSoft's standard Java runtime cannot unload a class, you need to quit Metrowerks Java and restart it after recompiling your source code. You can control various parameters of the virtual machine operation, including class search paths, heap and code stack sizes, and garbage collection rules.
The Java runtime provides a console output window for program diagnostic messages, a display of virtual machine status (CPU load and memory usage) and a thread state indicator. The thread state window shows a moving history of the state of all threads in the system and their transitions between states.
Given CodeWarrior's multi-language abilities, it is natural that it should support native Java functions. Alas, native methods are not yet fully supported; more information about what you can do with native methods is available from Metrowerks technical support.
Aside from application development support, the other distinguishing feature of CodeWarrior is its source-level debugger. Though there are a few missing features in this beta release, you are able to set and clear breakpoints by clicking next to a source line of text, view the call chain, step through code, and inspect variables. You can also set breakpoints to catch the various Java exceptions without actually adding code to your application. You can even invoke the debugger against an already running applications or applet. I had several crashes on a 68K Mac when trying to view byte-codes; but since source display worked fine and is the obvious preference, the debugger is quite usable even on old machines.
While Metrowerks is a relatively late-comer to the Java market, its leadership in the C/C++ development market is providing a solid base from which to become the dominant supplier of Java tools also. The stability of this Beta release stems in large part from Metrowerks' ability to extend their proven development environment, though there are places where the use of non-Java terminology may be initially confusing. CodeWarrior Gold 9 offers solid Java performance and some interesting new twists for building applications.
About the Author