CodeWarrior Pro 7.0, by Metrowerks
Posted: 24-Nov-2001

4 out of 5 Mice

Vendor: Metrowerks Type: COMMERCIAL

Reviewer: Bill Catambay Class: PRODUCTIVITY

CodeWarrior is a cross-platform development environment for Macintosh, Windows, Linux, and more. This review is of CodeWarrior Pro 7 for Macintosh. The review machines are a G3/333 and a G4/867, running in OS 9.2.1 and OS X.

While Visual Basic has a growing user base on the Macintosh, and THINK Pascal still has a faithful following of its own, CodeWarrior is the primary tool used by the majority of software vendors building Mac applications. CodeWarrior includes compilers for C/C++ and Java, a fine-tuned IDE (Integrated Development Environment) for editing, compiling and linking, a built-in debugger, and a sophisticated class browser.

There are a lot of new features included with CW Pro 7, but the most important is the ability to develop on and build for both Classic Mac OS (OS 9.x and below) as well as Mac OS X. This means that you can build native OS X applications on either Mac OS 9 or in OS X, and when you are on OS X, the IDE is running native. This feature alone is worth the price of upgrading to CW Pro 7.

Writing code to run native in OS X, however, is by no means as simple as taking an old project and building it with CW Pro 7. To run native, you must use the new Opaque data structures that Apple has switched to, and this alone requires quite a bit of reworking of your old code base. For example, where you once accessed a field of the WindowRecord structure, you must now use a corresponding toolbox call to access that data. In addition, there are old toolbox routines that are no longer supported in OS X (aka, Carbon), and must therefore either be removed or replaced, depending upon the routine. The in's and out's of porting to Carbon are an exercise for the user, and although necessary to program native on Mac OS X, they are not a feature of the CW IDE. For a complete guide on porting to Carbon, check out Apple's
Carbon Porting Guide.

Features found in CodeWarrior Pro 7:

  • C/C++ and Java compilers
  • Mach-O support (builds native OS X applications)
  • Mac OS X hosted command-line tools
  • Mac OS X Project Converter
  • Java 1.1.8 for Classic Mac OS and Java 2 for Mac OS X
  • Visual Java Development (Property and Layout Editors, RAD, and more)
  • Carbonized IDE v4.2.5 (runs native in OS X)
  • PowerPlant C++ Framework
  • Multi-functional Project Manager
  • Profiler
  • Powerful Search Engine
  • Class Browser
  • Integrated and Remote Debugging
  • Multi-processor Debugging (Classic Mac OS only)
  • Shared Library Debugging Support
  • ANSI C Compliance (C89)
  • ANSI/ISO C++ Standard Conformance
  • Locale support for Unicode/UTF-8 file I/O
  • Latest Altivec support (Velocity Engine)
  • Carbonized Visual Source Safe Plug-in
  • Open API for Integrating Third-Party Tools
  • Online Documentation with Examples
  • Sample Projects
  • PowerPlant Tutorial


Compilers

The C++ language has been through some significant changes over the last several years, culminating in an ISO/ANSI standard for the language. Some compiler manufacturers were reluctant to implement several of the changes until the standard was approved. Many compilers are still not completely compliant with the standard. The CodeWarrior compiler aced the test.

Support for Java has greatly improved as well, including the Visual Java development and Java 2 for OS X. My Java experience is limited, and I did not fully test the Java compiler, but the sample projects all seem to work fine, and are an excellent starting point for those wanting to learn Java.

Not mentioned in the documentation for CW Pro 7, nor on Metrowerks products page, is the availability of Pascal and Object Pascal compilers for CW Pro 7. This little gem can be downloaded from Metrowerks
download page (in the Pascal community, this package is nicknamed "Nirvana Pascal" because it provides Mac Pascal programmers a tool to build native OS X applications in Pascal, something they never thought they'd see). For Pascal support, however, do not go to Metrowerks, as they have indicated that this is the last and final update of their Pascal compiler for the Mac. All your Mac Pascal support needs can be met at Pascal Central and the associated MacPascal mailing list.

Compiling in CodeWarrior is relatively fast. There have been improvements made to the compilers over the years, and although not totally bug-free, I found the compilers to be quite stable.

IDE

At its heart, CodeWarrior is an integrated development environment. This means that the compiler, debugger, text editor, and source control utilities all interact together. When the compiler detects a warning or error, the appropriate line (and word) is highlighted in the editor, making compilation error correction much faster. When debugging, source code lines are graphically selected to set/clear breakpoints. Variables are highlighted to examine their values. An IDE increases productivity substantially over command-line development environments.

From the File menu, you create a new project, and are presented a template dialog. CodeWarrior provides templates for all the types of development listed in the template window, and various options at the bottom of the dialog. For example, selecting MacOS C++ / Standard Console / PPC / Std C++ Console PPC creates a project for a complete C++ program sending output to a console window (stdout). It even includes a default "Hello World" main program that can be edited or replaced as desired. These ready-to-go templates make starting from scratch much easier.

Some noticeable improvements have been made to the IDE from previous versions. The IDE itself feels more fluid and speedier, for editing, compiling and building applications. I was pleasantly surprised to find that the search utility had been separated into two search types, single file and multiple file searching. In prior releases, there was one search dialog, and to switch from searching in a single file (such as your current source file) and searching in a list of files (such as the Universal Headers or Universal Interfaces), you had to toggle a multi-file button. In CW Pro 7, Cmd-F now presents a simplified search dialog that searches only in the current source window, and Cmd-Option-F brings up a separate multi-file search dialog. Although it took some getting used to at first (breaking old habits developed from the old method), this is a better search tool. With the old method, more times than I can count I would want a quick search in my source file, but I would forget that I had the multi-file button down, and so the search went through a bunch of other files. This annoyance has been completely eliminated.

I did not notice a whole lot of new features in the IDE, but then again, if it ain't broke, don't fix it (Apple has a lot to learn from that old saying, as I still have a difficult time navigating in the OS X Aqua interface). There is seamless integration between the compilers, text editor, project manager and debugger. Compiling is as simple as clicking a button. If there are errors, an error listing is displayed. Click on an error message, and the code containing the error is displayed in the lower box of the error window. Double-click on the error message, and the window for the source file opens up highlighting the line containing the error. You can edit the code in either place. For linking, the IDE still hasn't figured out a way to integrate action to take for link errors. The messages are static, and the developer must figure out what to do and where to go to fix it. Once your project builds (compiles and links), you can run with the debugger and step through your code. I did notice some improvements in this area, as switching back and forth between the debugger and the code seemed to work easier.

There are a lot of features included in the IDE which the more experienced developer can take advantage of, such as a surplus of preference settings, project settings, target settings, class browsers, and more. All in all, IDE 4.2.5 is a well built and finely tuned instrument for building Mac applications.

Debugger

The debugger is an important part of the IDE, warranting its own review. To Metrowerk's credit, the CW debugger has come a long ways from its previous versions. The seamless integration into the IDE is fantastic, and it provides wonderful ease-of-use for stepping through your code. Many of the things you would expect from a debugger, such as setting breakpoints (which you can actually do in the standard editor now when debugging is enabled), examining variables and memory, are all included, and relatively simple to access. However, there are still quite a few things that bother me about the debugger.

When stepping through code, the list of variables provided to view in the debugger window now only include those variables accessed in the current scope. For example, if in a function, even with "all variables" selected, you will not see the global variables that are not accessed within the function. You can, however, open the Globals Variables window to see them. Similarly, in viewing a constant, I wanted to just click on the constant name to see the value of the constant, but didn't find that the case. I was able to right-click the constant to have the debugger take me to the constant declaration, but I would have preferred to have stayed where I was and just have the debugger tell me the value. I also ran into problems with Opaque data types. Granted, these types are no longer pointing to record structures, but they are still pointers, and it would be helpful to have them displayed as pointers for determining NULL conditions. Unfortunately, I found the debugger to be quite inconsistent with these variables, sometimes displaying them as pointers (pointers are displayed with a triangle to the left of the variable name and followed by the address they are pointing to), but most of the time just displaying them as junk. I would have to do a "view as..." to get the appropriate address displayed.

The issues that bothered me most about the debugger, however, were inconsistencies in the behavior of displaying data values, and its inability to step through errors without crashing or dropping into meaningless assembly code. I would often view variables, especially pointers, and have different results displayed without having executed any further steps of the program. This made it difficult to trust the values returned by the debugger. Likewise, more times than not, if I had memory leaks in my program, or simply tried to do things that the OS did not like, the debugger was not sophisticated enough to catch these errors before either dropping into assembly or crashing. Some of these issues are probably due to the structure of the Mac OS, but I think the debugger could be greatly improved in this area.

One other problem which I noticed is that the "stop" button seems to be broken. In prior versions of the debugger, I was able to click on the stop button (the button with the red square), and execution would stop and display the code. Now I click the button and nothing happens. The only way I found to get back into the code was to open up the source code file, and set a breakpoint where I knew the code would pass through during it's current cycling.

While the debugger functions are intuitive and appear to function as designed, you don't always get accurate or consistent results, and underneath the hood there is still a lot to be desired.

PowerPlant

PowerPlant is an extensible application framework that Metrowerks has been perfecting for many years. It provides C++ wrappers around most of the Mac OS Toolbox features that application developers need to use. It includes a WYSIWYG GUI builder (Constructor) that allows you to create the basic layout of your application by dragging components from a pallette to the appropriate place in your application windows. This tool allows complete customization of each GUI component and builds the appropriate resources automatically.

As with most GUI builders, PowerPlant does not remove the need to understand the fundamentals of the Macintosh programming model. It does, however, shield you from most of the mundane details, allowing you to concentrate on the portions of your program that make it stand apart from all the rest. Likewise, PowerPlant is not an all or nothing framework. You are free to use as much or a little of it as you wish. In practice, the PowerPlant framework and classes are a bit too busy for me, especially given my desire to always do things my own way and veer off the beaten path. For those who don't want to tinker too much in the Mac toolbox, however, PowerPlant provides an excellent "head start" on programming Mac applications.

Documentation

CodeWarrior Pro 7 comes on two CDs: one CD for Developer Tools, containing all the relevant parts of the IDE, such as the compilers, library files, templates, etc., and the other CD for Reference materials. The Reference CD is chock full of useful documents, such as the IDE user manual, specific user manuals and reference manuals for the compilers, a PowerPlant manual, tutorials, loads of sample code, and much more. In addition to the material that comes on the CD, Metrowerks provides excellent support through it's web site, by means of the
Developer Resources page (White Papers, Newsgroups, and general Support), as well as CodeWarriorU.com, a great set of online programming courses available for free.

Summary

Metrowerks was the first to provide developer tools for the transition from 68K to PowerPC, and now they lead again by providing the developer tools for going native in OS X. CodeWarrior is, by far, the most popular development environment for the Macintosh platform. The IDE has come along ways, and provides the developer a very sophisticated environment for application development. CodeWarrior provides the organizational tools to make building Mac applications a seamless process, allowing the programmer to focus less on how to get the application put together and more on the coding of software. Despite some of the short comings that still exist in the debugger, I was very impressed with the Pro 7 IDE. With OS X support, as well as an improved search utility, I highly recommend CW Pro 7 for any developer for the Mac platform, experts and hobbyists alike.

Pros:

  • Builds native OS X apps, and runs native in OS X itself
  • Fully integrated compile/edit/debug environment
  • Stable compilers for C/C++ and Java (and although not "officially" supported, also available are Pascal and Object Pascal compilers for download)
  • Visual Java development
  • Improved file search utility
  • Lots of documentation, including tutorials and online "how to" classes at CodeWarriorU.com

Cons:

  • Lack of integration with 3rd party text editors
  • No longer comes with Pascal (though Pascal can be downloaded)
  • Stability and consistency problems with the debugger
  • Some primitive debugger functionality


Overall Rating:

4 out of 5 Mice