Wednesday, February 08, 2006

Eclipse (SWT) in Mac OS X: Why Carbon Instead of Cocoa

Source: SDA India Magazine

A few reasons exist as to why SWT on Mac is built on Carbon instead of Cocoa. Cocoa it seems looks like a SWT peer and it would be difficult to port SWT to it, because of event loop issues and other random problems that arise during porting.

Cocoa is easier to work with on Mac, but it does try to do things in different ways than Carbon. Even though Cocoa applications have good features, it would take quite an effort to convert them to carbon, as the widget hierarchy is completely different and wouldn't necessarily fit in with how SWT works. Secondly, most UI development under Cocoa is done under Interface Builder rather than programmatically. Carbon could have had a better .app launcher under Mac OS X, as it launches a separate VM, but this is more of an eclipse-imposed restriction.

The Carbon environment runs all Mac OS 8 and OS 9 applications whose code has been optimized for Mac OS X. The Carbon environment features a set of programming interfaces derived from earlier versions of the Mac OS. By converting their code to use the Carbon application programming interfaces (APIs), developers ensure that their products take advantage of protected memory and preemptive multitasking.

1 comment:

tamarok said...

Two years later (Jan 2008) and Apple has now officially marked Carbon as being due for deprecation.

Work is now being done towards a Cocoa version of SWT: