Cocoa In Pieces

cocoatracescodebeach
Two new sites have appeared recently: CocoaTraces and CodeBeach that fit something of the same need. They are both repositories for pieces of working Cocoa source code, stored in such a way that it should be possible to find it if you need it.

Resources For Cocoa Programmers

Writing Random Wok and other code is always a very punctuated experience. I decide what to implement next, then read and take notes, then figure out what I think I need to do, then write the code, then debug, then blog. Sometimes a lot of time is spent during the reading and figuring out stages as I try to understand either how something is done, or, knowing how it is done, trying to understand how to do it that way in my code.

I go to several offline and online resources to get my curiosity satisfied, my brain overloaded, and my questions answered. Here is a short list of where I go, in order of attack:

1. XCode's Built-in Help and Documentation


My first stop is XCode, Apple's IDE for Cocoa development. XCode has a great deal of information built in: more than a gigabyte of Reference Library, in fact. Access to it all is via XCode's Help menu:
cocoadoc9
The documentation for XCode itself is found via the XCode Help item. The full developer reference library opens in a viewing window via Documentation:
cocoadoc6
The documentation window has two modes of searching. If you don't know how these work you will not find things and be very confused. Access the modes by clicking on the magnifying glass:

cocoadoc2
API search is immediate and needs no carriage return. The window below the search box shows the matches in order of fit. Click on one and I have the document in the lower pane. Double click and it opens in a separate window.

Full-Text Search is not immediate. I must press carriage return for anything to happen. And then the scope of the search is controlled by the selection in the library browser on the left:
cocoadoc1
My search for NSNull will only be carried out for documentation on Carbon in this case. I have to leave the Reference Library line at the top selected if I want to see all the documents (as I normally do).

The help menu also has two search items that work on selected text. Find selected text in documentation and Find selected text in API reference. An option double click on a word also takes me to Find selected text in API reference. I use this all the time.

Another very handy shortcut is to command double click on a word. That takes me to the definition in the code. This can be very useful because the context and comments in the code can often tell more than the documentation:
cocoadoc5
I set the languages that are searched via the Configure Options button on the toolbar:
cocoadoc10
I don't do C++ or Java and this prevents anything about them from showing up. Updates come out periodically. I have auto-checking enabled in the preferences:
cocoadoc4
So that I get update notifications:
cocoadoc3
And when a new set of documentation is available, 250 MB or so later, I have it.

Finally, I have access to the Man pages at the bottom of XCode's Help menu. I don't type "man" into a terminal: it is all there in the XCode documentation package.

2. Spotlight


cocoadoc11
The next place I go is Spotlight. I have all of the developer material indexed so spotlight will locate example code, saved web pages, and all kinds of other documents on my hard drive.

3. Cocoadev


cocoadoc7
Then I go to the web. Cocoadev is a WikiWikiWeb site containing a huge amount of user-contributed advice, code, explanations, links, and other material. It is easy to search, and you can contribute your own comments.

4. Cocoabuilder


cocoadoc8
Cocoabuilder is an archive of all of the postings to the Apple XCode, Cocoa, and Macosxdev mailing lists. There is a lot of Apple input on there. You can't post here. To post questions, sign up for the appropriate mailing lists at http://lists.apple.com/.

5. Borkware Quickies


logocowname
Borkware and its associated Quickies page is a great place to find some of more useful and less documented ways of doing things. It's the creation of Mark Dalrymple, author of several Unix and Mac programming books and head nerd at the Big Nerd Ranch.

6. Google


logo
Finally, I Google what I am looking for. That will catch all kinds of things, including hits on the core foundation code, and open source efforts to duplicate parts of the Mac OS.
The Bagelturf site welcomes Donations of any size