Sunday, January 21, 2007

Learning Cocoa: Which Frameworks to Learn?

I've been wondering which frameworks on Mac OS X I should learn. It's hard to know the answer to this, since different applications will need different frameworks. But it occurred to me that examining the frameworks that Apple uses in their own applications might be a good start.

Not too surprisingly, you can determine the shared libraries used by an application. So I whipped up a little shell script to go through a set of applications and print every framework used and the number of different applications that use it. The applications are:

  • Address Book
  • Automator
  • Backup
  • Calculator
  • Chess
  • DVD Player
  • Dashboard
  • Dictionary
  • Font Book
  • GarageBand
  • Image Capture
  • Mail
  • Photo Booth
  • Preview
  • QuickTime Player
  • Safar
  • System Preferences
  • TextEdit
  • iCal
  • iChat
  • iDVD
  • iMovie HD
  • iPhoto
  • iSync
  • iTunes
  • iWeb
  • Keynote
  • Pages

There are more than 100 frameworks used by these applications! Wow. This little experiment reveals some unsurprising things: learn Cocoa. But it also suggests that there are at least portions of Carbon that are required reading (the Carbon framework is the second highest used). There are some odd things near the top, like iMovieSupport.framework and some things that are obviously important but I don't know what they contain (like CoreServices.framework).

If we arbitrarily remove all the frameworks used only once, we still have 71 frameworks. If we remove those used 2 times or less, we still have 61. If we remove all that are used less than 10 times, we end up with 18 frameworks:

100 - Cocoa.framework
93 - Carbon.framework
50 - QuickTime.framework
48 - CoreServices.framework
35 - Foundation.framework
33 - OpenGL.framework
33 - CoreFoundation.framework
30 - iMovieSupport.framework
27 - AppKit.framework
24 - ApplicationServices.framework
24 - AppleAppSupport.framework
21 - IOKit.framework
17 - SystemConfiguration.framework
16 - QuartzCore.framework
13 - Security.framework
13 - AddressBook.framework
11 - QTKit.framework
10 - BDControl.framework

This is much better than 100, but still too large. I guess I need to figure out what is in these libraries and go from there. Until I can do that, I have plenty to do just learning Cocoa fundamentals and the development tools.


cas (Charles Sharp) said...

Interesting question. (This ties very neatly into a post today by Dan Russell at the Creating Passionate Users blog:
about how to "make sense" of big things.)

Just looking over the list, I'd probably take a look at the framework that's at 100%, Just from a probability perspective ;-).

But then I'd drop down the list a bit. Assuming that the good folk at Apple put some thought into the names, when I see "Foundation", "CoreFoundation", and "CoreServices", I get a certain sense of "basic." In addition, the Mac OS X Technology Overview (
mentions the "CoreXXX" frameworks several times. Another possible candidate for this list would be the Application Services.

Seems like whatever type of application you end up writing, at least knowing what these services make available is going to be useful.

Hey. Thanks for doing the summary work on the frameworks. As you know, I'm in a similar situation and I appreciate the guidance this gives.

Anonymous said...

Foundation is the non-GUI portion of Cocoa, collection classes and such, so you're going to need it in any case. CoreFoundation is the C API underneath much of Foundation.

The interesting bits of Carbon (for most developers) are in the ApplicationServices framework, and it's probably eventually worth your while to poke around it.