views:

2348

answers:

7

I think one of the best ways to learn a new programming language is to dive into source code and see how experienced coders write. I've found this kind of question asked here on Stack Overflow for other languages, but none targeted at Objective-C. The closest I've found is this question about good-looking Cocoa user interfaces, but I'm thinking in terms of general code quality, such as good use of idioms and design patterns, and usable documentation. Another good characteristic would be a code-base that is large enough to require real organizational discipline, but small enough that a beginner can fit his/her head around.

What do you think is a high-quality open source project that meets these criteria?

+1  A: 

I don't think there's any one place to learn all the Objective-C idioms and best practices, but you can pick them up here and there over time and practice. Cocoa mailing lists and blogs are good resources for this. (There are several SO questions relating to that.)

I haven't dived into the source myself, but the Omni frameworks are well-respected in the Mac community.

I work on a framework of my own that's still rough around the edges, but I strive for quality documentation in addition to understandable, well-structured code.

Quinn Taylor
+1  A: 

Here's a test app I wrote earlier today. Download links under “get source” in the top-right.

It's small, but it demonstrates good organizational discipline (separate controller object, instead of everything crammed into AppDelegate), a simple model layer with one model class (Header), and correct use of Cocoa Bindings.

Peter Hosey
+4  A: 

Google Quick Search Box [ qsb-mac - Google Code ]

I think The Google Quick Search Box (QSB) is worth a look. IMHO it's pretty much a cleaner googley rewrite of Quicksilver (Note: N. Jitkoff, the QS programmer, is also involved in the Google QSB).

f3lix
+2  A: 

Apple has tons of downloadable examples on their developer website. You get to see the source, and the license is BSDish from what I recall (use it for whatever, but don't repost original code without the license).

http://developer.apple.com/samplecode/Cocoa/index-date.html

z5h
The sample apps included with the Developer Tools are a good place to start learning too.
Marc Charbonneau
A: 

I used to work on the GNUstep sources, they've got a good consistent coding style and the code is well-organised. Of course the project is hardly small, but given that you know what most of the classes do as you've used them in your Cocoa projects it's easy to zoom in on a piece that interests you. Some of the GNUstep Applications Project or Étoilé apps may also be a good place to start.

Graham Lee
+4  A: 

I've found Adium to be a well-designed and written Objective-C project. It has a huge codebase, too.

mipadi
I looked through many of the suggestions here, and I find this is closest to what I'm looking for, so I've started studying the source for Adium. Like you said, it has a big codebase, but fortunately it has not been too daunting to navigate a piece at a time.
alanlcode
+4  A: 

There's a decent list of open source Mac projects on CocoaDev: http://www.cocoadev.com/index.pl?CocoaOpen

Not all of the projects are still active, but a decent number of them are. I particularly recommend:

Dave DeLong