CodeWarrior 6.1, by Metrowerks
Posted: 24-Apr-2001

3 1/2 out of 5 Mice

Vendor: Metrowerks Type: COMMERCIAL

Reviewer: Jim Melton Class: PRODUCTIVITY

CodeWarrior is the de facto standard environment for Macintosh software development. Version 6.1 includes more features than I could evaluate. It has support for development in Java (applet, application, bean), MacOS (C, C++, PowerPlant), Windows (C, C++, MFC) and Mac/Windows cross-platform development. I evaluated the MacOS C++ and PowerPlant features. Note that Java development requires the Java SDK from Apple.

CodeWarrior is many different things. For C/C++ language development, the core component is the compiler. To help manage the whole software development process, CodeWarrior is an Integrated Development Environment (IDE). To simplify Mac programming, CodeWarrior includes the PowerPlant application framework and Constructor GUI builder. And
to help fledgeling programmers learn about programming with CodeWarrior, Metrowerks provides CodeWarriorU.com.

I started this review as a better-than-average C++ programmer for Unix with no Macintosh programming experience at all. Several years ago I bought a copy of "Inside Macintosh" and a copy of CodeWarrior Bronze (then versions 5/6/7, pre-Pro versions). I found the learning curve too steep for my hobbyist commitment and let these tools languish. I was aware of PowerPlant (just introduced when I first bough CodeWarrior) and I wanted to know if it had become easy enough to use for someone like me.

I've just scratched the surface of the capabilities of this product. However, capabilities are explored as a need arises. Your mileage will certainly vary, depending on which capabilities you need and use.

Compiler

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.

I have developed a test program over the years to evaluate compiler compliance with the ANSI C++ standard. The CodeWarrior compiler aced the test. In fact, the CodeWarrior compiler is so good, it taught me a thing or two about strict ANSI compliance. This is the compiler the language was meant to have.

The CodeWarrior compiler has a number of settings to allow you to control compiler behavior. If you're not ready for a fully ANSI C++ compiler, you can relax things a bit. Or, if you just want a C compiler, you can turn C++ off entirely. You can even enable Objective-C support.

Compiler performance is reasonably fast. In some ways, it feels slower than it is, because the user interface provides feedback on the number of lines compiled. However, a 120-line test program results in nearly 121,000 lines compiled.

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 compiliation 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 present 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 templates are extremely helpful, as the other pieces (besides the code you write) that are required for Mac applications can be quite confusing. A ready-to-go template makes starting from scratch much easier.

Although all the pieces of the CodeWarrior IDE work flawlessly, I was disappointed. The whole thing feels sluggish to me. I used to think my machine (8500 with Sonnet G3/400, 160MB) was pretty zippy. CodeWarrior made me want a 700MHz G4. The text editor is painfully slow. I thought I remembered previous versions of CodeWarrior allowed you to integrate the editor of your choice; certainly popular editors like BBEdit and Alpha have the hooks to facilitate such integration. However, try as I might, I was unable to find an option to change the editor. I ended up using Alpha to do my editing and manually switching between applications for compile/edit/debug. A simple search/replace on a 120 line file took seconds to complete in the CodeWarrior editor. The same operation was nearly instantaneous in Alpha.

The project window (the main window that displays the project data) feels similarly sluggish. Several times, after saving a code change, CodeWarrior seemed to not respond to the hot-key command to make the program. Using the mouse usually managed to get its attention. Also, the Project menu in the menu bar would flash (as if it had been selected).

Debugger

The debugger is perhaps the most important part of the code/debug/edit cycle (unless you write perfect code the first time).
The CodeWarrior debugger feels primitive to me. I had two simple applications that I played with: my compiler tester that uses the standard console, and a GUI toy that I created using PowerPlant (see below).

The debugger comes up in a three-part window. The first part is the stack trace. This behaves as one might expect, where the subroutine call stack is displayed. Selecting anywhere in the call stack allows you to examine the state of a calling module.

The second part is the data display. Every variable defined in the current scope is displayed. Pointers can be expanded using an outline motif to dereference them. One misleading feature of this part of the debugger is that variables are displayed with a value, even before they come into scope. In C++, this is just wrong, because before an object's constructor completes its state is undefined. The debugger does not seem to be aware of these scoping rules.

The third part is the text of the currently executing function (if available) or the disassembled code. The debugger manages stepping through C++ or assembler equally well.

Of the applications I tested the debugger with, the compiler tester was simple enough that it didn't stretch the debugger's capability. It did successfully trap the exception that I threw, although there is no granularity of exception handling. Any exception that is thrown will be caught, even if it is handled deep in a third-party library.

The GUI toy I also used to test the debugger was not any more complicated than a very basic Macintosh application, but that is still complicated enough. I put breakpoints in every method so I could trace down into the bowels of the PowerPlant framework code. As the application continued to try to respond to events (such as draw, refresh, mouse click), the debugger became more and more sluggish.

The debugger functions are intuitive and appear to function as designed. However, I found the performance unacceptable. I did not put the debugger through industrial strength testing, so your mileage may vary.

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.

When I started this review, I had no experience writing Mac GUI software. After a day or so of learning the fundamentals of
PowerPlant, I was able to write a functioning application that updated text labels in response to button clicks in just a few hours. (My 1988 printing of "Inside Macintosh" is still gathering dust on the shelf)

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 important part of your program, what it does.

PowerPlant is not an all or nothing framework. You are free to use as much or a little of it as you wish. It does not cover graphics programming, so if you have QuickTime or OpenGL code you have to do it yourself. But the rest of your program (window creation/layout, menu construction, etc.) can take advantage of PowerPlant.

CodeWarriorU.com

Metrowerks hosts this web site, providing free, on-line interactive courses in a variety of topics. At the time of this writing, courses include "Introduction to PowerPlant" (parts I/II), "Learn Programming With C", "Introduction to CodeWarrior" (Mac/Windows versions), "Java Programmer Certification With Metrowerks CodeWarrior", "Programming Motorola's DSP56800 Processor Family", "Introduction to C++", "Intermediate C++", and "Advanced Placement (AP) Computer Science".

I went through most of "Introduction to PowerPlant Part I". Previous attempts to use PowerPlant were frustrated by a lack of "how to" documentation. This course filled the gaps and gave me enough information to get going.

Summary

CodeWarrior for C++ doesn't really have any competition. Metrowerks provides *the* development environment for the PowerPC platform. This is probably why Motorola purchased Metrowerks in 1999. CodeWarrior will certainly support your needs, whether you are writing hobbyist applications for your own amusement, or the next replacement for Microsoft Office.

Well written software hides the complexity of what it is doing. CodeWarrior does everything required for software development well enough that you don't think about it. My only complaints were regarding user interface responsiveness. There are some significant performance issues here.

Pros:

  • Full ANSI C++ standards-compliance
  • Fully integrated compile/edit/debug cycle
  • PowerPlant application framework/Constructor GUI builder
  • On-line "how to" classes at CodeWarriorU.com

Cons:

  • Lack of integration with 3rd party text editors
  • Slow native text editor
  • Sluggish responsiveness in IDE
  • Primitive debugger


Overall Rating:

3.5 out of 5 Mice