oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

Mixing Java and Titanium, Part Two
Pages: 1, 2

Experiences with Project Builder

The centerpiece application on the Developer Tools CD that ships with standalone versions of Mac OS X is an Integrated Development Environment (IDE) called Project Builder. This is a new effort from Apple that is adept for writing C-based kernel modules, Objective C Cocoa applications, C++ based I/O drivers, and general purpose Java work. Unlike most Java-capable IDEs, it launches quickly and doesn't completely take over your monitor with tool bars and windows.

When I say that it launches quickly, I mean that it launches extremely fast, compared to most of the other IDEs on the market. On my PowerBook G4, Project Builder is ready for action less than five seconds after double clicking on the application's icon. Contrast this to other Java capable IDEs that take half a minute, a minute, or more to launch. To be fair, Project Builder doesn't sport some the feature list of other IDEs. Notably, it leaves interface building to external applications. And that is fine by me, as I have been asking IDE makers to make a simpler tool for a long time, one that I can edit, build, and debug code in. Project Builder delivers just this and does it fairly well.

Project Builder comes with starter projects for writing Java applets, Java AWT-based applications, Java Cocoa-based applications, and a generic Java project type called "Java Tool." All of these starter projects are set up to easily build reasonable products. In fact, the Java AWT-based application builds MRJ-based application bundles of the type that I described in my last weblog entry.

But what if you don't want to start a new project? What if you want to use Project Builder to work on an existing project? I wrestled with this for a while until one of the Apple developers turned me onto the misnamed "Legacy Makefile" target. The trick is to create a new target of this type, and then customize it to do execute whatever command you need to. The target takes essentially three important pieces of information:

  • Program to execute
  • Arguments
  • Directory to execute in

With this target, you can execute any command you want anywhere on your system. Really, this should have been named the "Custom Build Command" target type. After finding this out and setting it up to use my own build tools, I have found myself doing most of my day-to-day Java coding in Project Builder.

Not withstanding the good points, Project Builder is a freshman effort, and there are several rough spots that I hope Apple fixes soon. One such rough spot is that break point makers don't maintain their relative position as you edit the code that they point to. This means that when I'm in a debugging session, and editing code, I have to keep adjusting my break points.

There also seems to be an intermittent performance issue when debugging Java code. So far, it only seems to strike me when my laptop is configured with a hostname that cannot be resolved (for example, when I unplug from a DHCP network). If I have my hostname set to localhost, debugging works fine. I haven't conclusively proven this yet, and your mileage may vary, but it seems to work for me. Apple's developers are aware of the issue and have said that they have a fix in the works.

Even with the rough spots, Project Builder is a nice tool. If Apple keeps improving it, I may have finally found a lightweight, fast, easy-to-use IDE that satisfies, something that no IDE yet has been able to do for me.

Fun with Quartz

A lot of graphics magic happens in Mac OS X to make the UI go together the way it does. In fact, I'm still scratching my head wondering how it's all done so well. To help peek behind the curtain, Apple has provided a tool that at least gives a glimpse into the magic that Quartz performs. It's called "Quartz Debug" and it can be found in the Developer folder after you install the Developer Tools CD.

When you launch Quartz Debug, a simple window is displayed. Enable the Flash Screen Updates and No delay after flash checkboxes and then use your system as normal. Every screen update is preceded by a yellow flash which lets you see what Quartz is redrawing. This is most impressive when mousing over the dock with magnification enabled. As the icons are scaled, you can see the exact set of pixels that are getting recalculated.

Of course for most users and developers, seeing this in action is more fun than actually useful. But I found it to be an interesting view into how Mac OS X works. Enjoy the show!

James Duncan Davidson is a freelance author, software developer, and consultant focusing on Mac OS X, Java, XML, and open source technologies. He currently resides in San Francisco, California.

Return to the Mac DevCenter.