08 September 2006

Mixing Carbon and Cocoa

Oh now this is so, SO refreshing and from a "Cocoa" developer no less! I don't know how many times I've heard the comment that we've got to re-write all of Office in Cocoa as if that were some magic pill that turns all Mac applications into "pure" Mac applications.

Wake up people! It’s 2006. It doesn’t matter what you program in, it’s how you get the job done. Arguing about whether to use Carbon or Cocoa is like arguing about whether to use a net or a hook to catch a fish. You use whatever the circumstances call for. If you don’t, you die. (This, from the vegetarian, city-dwelling Mac programmer).
Once again, it's all about execution. Now I love Cocoa (We use it internally to build all our GUI based tools) I love the design patterns and consistency, and I love CoreData and bindings, but very often if you want to do something cool, you almost always have to drop down to the C API and well, more often than not, you're using Carbon. Remember what Steve Job's said when introducing Carbon? "We named the API Carbon, because that's what all intelligent life forms are made of!" I'm personally looking forward to the end of the whole Cocoa vs. Carbon debate. Sometime in the future, applications will be judged by what they enable you to do rather than the API under the hood. If you want to get that concerned about the nuts and bolts, consider this the next time you fly: Every part that makes up every plane, came from the lowest bid supplier. Life's too short, find the right tool for your job and enjoy the ride!

8 comments:

Skaran said...

Mr. Weiss,

I'd just like to have the common Mac user's say in this. You see, it's not that Mac users like myself have had a vendetta for Carbon applications since ever they came out just because of the low-level API stuff that we don't really understand, but it was due to the fact that Carbon applications tended to always be the ones that simply didn't feel right.

For one, the ones that came out in the beginning stages of Mac OS X, i.e., in 2001-2002, a lot of them didn't have antialiasing or any of the other features that made Cocoa applications look polished and Mac OS X-like. Also, more often than not, Carbon applications simply felt "slower" to use, and although with faster computers that has become less noticeable, don't think for a second that I don't notice how glacial Microsoft Office 2004 runs on my computer. Also, it's always the Carbon applications that have weird inconsistency bugs. Every text editor using Mac OS X's Cocoa text fields can input and ouput in Hindi text (my native language) but Microsoft Word refuses to.

It's not that we care about the name of the API being used or how modern it is, but a Carbon app just doesn't feel right. A Cocoa app does and that's why people've been wanting apps written in it. The most important thing to know about Mac users is that they may not know a lot about computers or programming, but they know how the Mac works and how it's supposed to. And if they're saying something's wrong, then something's wrong.

David Weiss said...

Skaran,

I don't mind customers pointing out things we can do better, no matter their programming skill set. Like you say, "If they're saying something's wrong, then something's wrong." Where it gets difficult for me, is when they suggest a blanket solution for a very complex problem. Sure, we could re-write all of Office in Cocoa, but that wouldn't necessarily make it faster, more polished or Mac like. (or sooner to market...) Now don't get me wrong, AppKit (the part of Cocoa that users see) is very powerful and provides a foundation that you can build upon very easily to generate great looking UI, it excels at that, but it's not the only option. Perhaps a more tenable suggestion would be, "Please give us a more responsive, fun Office experience." and then we could try to deliver that experience in the most cost effective way possible, Carbon or Cocoa or whatever.

David Weiss

Rosyna said...

How odd. I've always found cocoa applications to be by far the slowest applications I use. Especially with large amounts of data. Carbon applications did feel a lot slower at first because most were using WaitNextEvent() with a 0 wait time. This made them suck CPU even when idle. Most Carbon applications don't do this any more and instead use ReceiveNextEvent() or the preferred RunApplicationEventLoop() which completely removes polling.

Cocoa Applications like Delicious Library, Xcode, iPhoto, iDVD, Mail.app, et cetera all fail miserably with even moderate amounts of data.

Anonymous said...

I believe that if most Mac users are willing to have app developed in Cocoa its because of two things: the look and the idea that Cocoa app would be much faster. (Whether it is true or not is another debate)

I remember I used to shout every bad word I knew while using Quark Xpress as a carbon app for years after all the majors apps were running on Cocoa.
It was indeed much slower than anything else and the look and feel was of course bad. And when Quark was translated it was still buggy and uneasy to use, yet it was OSX native.

First version of the office for Mac OSX was a real nightmare when you had to work with eastern European languages or Japanese text that had been typed on a Windows PC. Next version has been highly appreciated because most of the compatibility problems were solved.

But I have to admit that yes, this debate is kinda "forced": what makes an app a good app is what you can do with it.
Now to be a honest Mac user, if an app has an ugly look I won't use it because it doesn't feel "Apple touch".

Just a small last remarks, I believe this is false to say that Mac users do not know much about computers. Following that way, we could say that loads of PC users do not know anything because they're just using it at work. An we could say that if you buy a Mac, you think about what computer you want, you do not just buy the same computer as everyone.
All these are excessive, but it is making a general statement from a particular case.

Jérémie

Skaran said...

Mr. Weiss,

Of course, I do say all that to you: please make Office faster and more usable. But also, my main motivation behind that comment was to explain why there's a negative stereotype about Carbon applications. I must also say that I have seen some very good Carbon applications - the Finder, for one, does not feel like the stereotypical (slow, inconsistent UI) Carbon app. The problem is that most of the applications that are developed using the Carbon APIs do not feel as snappy or polished as their Cocoa counterparts, which is why Mac power users think worse of them.

The average Mac user? At best, he might be able to tell you that something's not right, but only the most attentive average user will be able to tell you that. On this blog and in most of the Mac community that is vocal online, you are talking to Mac enthusiasts who perceive these differences and get annoyed by them. I do not know the technical differences between Cocoa and Carbon to be able to give a concrete opinion on this except that I have heard people say that, in Carbon, you have to implement a lot of things such as UI widgets instead of having them implemented for you in a standardized way by the API and that is why Carbon applications seem inconsistent with the OS. However, whatever the case may be, I would like to see Microsoft Office be snappy and lightning fast… and if using the Cocoa APIs is the way to do that, so be it!

I do hope you release Office 2007 for Mac soon! It is 2007, isn't it? Oh, and another question I had was why the MacBU takes on so much more from Apple rather than Microsoft as far as tightlippedness is concerned? The Windows version of Office has customer preview programs, but the Mac version is apparently being carried out in silence just like Apple's own software? Isn't there a beta program a normal person can participate in?

David Weiss said...

Skaran,

Thanks for the thoughtful posts. Ah, the question about a public beta again. :-) I love how keen folks are to provide feedback and help out even before the product is final!

About our "tightlippedness" well, I guess we're like most businesses. There's a time to talk about stuff, and a time to refrain from talking. Now is the latter time. And yet, there are several MacBU blogs, and even an official one, so we are trying to get more transparent.

David Weiss

MaLer said...

I don't like those Cocoa vs. Carbon debates, but... show me some Carbon app, which use system spellchecker. I think there is no one. Everyone use or proprietary services (Microsoft, Adobe, BareBones BBEdit), or there is no spellchecker. And if you think "who cares" - we, users of different languages care. I have system spellchecker for Czech, but there is no Czech spellchecker from Microsoft... And so on, and so on. So for me, as a user, Cocoa app have one big advantage over Carbon.

Anonymous said...

I'm pretty sure that iTunes is a Carbon app. Since it cross compiles from the same source code on Mac/Win, and is written in c++.

So for usability, I think it works quite well.