Carbon and Cocoa sitting in a tree

John Gruber counters anti-Carbon arguments from Andrew Stone, again:

“Apple’s original plan more or less boiled down to replacing the Mac OS with NextStep; Mac developers had the crazy idea that it should be replaced with a new version of the Mac OS. Apple listened, the plan was revised, and six years later, here we are.

“Apparently, no one sent Stone the memo.”

The good news is that most of this Carbon vs. Cocoa stuff has died down by now. Developers realize that there are strengths in both APIs.

Over the last few weeks I’ve been experimenting with adding Cocoa functionality to an entirely Carbon app. It turns out this is fairly straight forward. In fact the hardest part was making the move to mach-o and an application package. At that point you can drop NIB files in to the project, and mix and match Objective-C with C++. All using CodeWarrior.

The integration is mostly seamless. For example I have drag-and-drop working between a Data Browser control in a Carbon window and an NSTableView in a Cocoa windows. The Cocoa code knows nothing about the Carbon window and the Carbon code knows nothing about Pasteboards. Another surprise was menu integration: NSTextView properly enables and responds to menu items in my Carbon Edit menu!