James Duncan Davidson is the original author of Apache Tomcat and Apache Ant. He was also one of the architects of the Java 2 Enterprise Edition Platform and wrote several versions of the Servlet API and the Java API for XML Processing specifications.
|<?php virtual(“/includes/boxad.inc”); ?>
Despite this rare pedigree, Davidson hosted a beginner’s session on the developer tools that come free with Mac OS X to an assembled group of around 50 seasoned UNIX and Linux programmers at O’Reilly’s Mac OS X Conference this afternoon.
“When developing Mac OS X, we hoped that they would let us expose the UNIX or release developer tools,” Davidson said. “Well, Apple let us do both.”
Mac OS X has three layers in which an application may run: Classic for legacy applications, Carbon — a hybrid layer that allows existing programs to gain many of Mac OS X’ features quickly — and Cocoa, the objective C based API that unleashes the full potential of Mac OS X.
To create applications on the Classic Mac OS or in Carbon, programmers needed to use some form of Integrated Development Environment such as CodeWarrior.
Well, to create applications for cocoa on Mac OS X, Apple created its own IDE called Project Builder. Just as Darwin is based on an open foundation, Davidson said that Project Builder is based on open standards, including the OCC compiler, the GDB debugger and CVS integration.
Cocoa divides the Graphical User Interface development problem into two parts, the layout of the GUI and the code that dictates how an application runs and manages that GUI.
So, Apple created Project Builder and Interface Builder. Project Builder manages all of the files for a project like a good IDE such as CodeWarrior would and also provides debuggers and a text editor. Interface Builder allows developers to construct Mac OS X compliant GUIs and bolt them onto their applications. It’s important to note that Project Builder and Interface Builder work cooperatively to create a complete Mac OS X cocoa application.
“Project Builder was the first IDE I actually liked,” Davidson said.
The IDE is based all in one window, unlike Code Warrior or other IDEs, which use dozens of windows for each development component. If you like, you can configure Project Builder to have multiple windows, and you may use your own text editor.
Interface Builder is a set of four windows. The large top left window shows you what you have, the bottom left has objects, the palette at the top right has hundreds of controls and widgets and the window at the bottom right corner is an inspector to check your actions.
To create a GUI for an application, the developer simply drags the elements they want onto the top left window and goes through a series of steps to log those objects into their code and bolt actions to them. You may create your own controls and add them to the palette, or you can add any number of third party controls to the palette.
Blue lines appear on the window to show developers Apple’s user interface guidelines for particular design elements. For example, if you drag a text box to a window, Interface Builder scores blue lines on the box that are Apple’s prescribed distance from the edges and corners for text. This is intended to be an aid, and Interface Builder will let a developer deviate from these guidelines.
Davidson created a small application as part of his demonstration. He created a text field and a button that changed that text field when you clicked it.
The presentation also highlighted some of the debugging features in Project Builder. These include traditional runtime debuggers as well as additional debuggers provided to troubleshoot issues specific to Mac OS X. For example, Project Builder includes a Quartz Debugger that highlights in yellow all the changes that the Quartz graphic layer makes in Mac OS X.
While this makes the dock appear as a yellow wave and makes a halo appear in the shadows of windows if they are moved, programmers can look at the patterns of yellow to see how they may optimize their code. Davidson created an application that animated a circle, but redrew the screen each frame of the animation. The whole screen flashed yellow when tested under Quartz Debug, which prompted Davidson to tweak his code so that only a rectangle of yellow was shown as the circle moved — saving many processor cycles.
Other developer tools that Davidson liked were FileMerge, which allows you to merge different types of files, and Icon Composer, which allows developers to create icons.
Apple’s Project Builder thus far creates applications in Apple’s frameworks, namely Cocoa, Carbon and AppleScript. There are works in progress to expand this utility to manage projects in camel bones, a cocoa hook to perl, and python and ruby.
Davidson also said that he has had some success with using Project Builder to develop in Java.