Brent Simmons On Large Cocoa Projects

Brent Simmons shares a good deal of wisdom in his post about managing a large-ish Cocoa project. In particular he’s referring to NetNewsWire, but his advice is especially pertinent to me now that I own and maintain a rather substantial number of source files that were designed and authored by Brent (MarsEdit, for anybody late to the party).

I love the emphasis on “researchability.” He points to the fact that projects of a certain size become impossible to keep in your head. So when you go to work on any particular subsection of the app, you need to be confident that you’ll find your balance quickly so you can get on with your work.

In particular, I liked the suggestion that weak binding in the form of notifications or key-value observing can be detrimental to researchability. Brent notes that the weak binding makes it difficult to mentally follow the source code, so it can be prudent to strongly bind classes that are otherwise useless without each other.

He also reminds us of some good IDE habits for maintaining code. I was glad to be reminded that the function popup in Xcode is keyboard invokable (as Brent says, “Every time you touch the mouse, God kills a kitten.”). This is very cool because with keyboard navigation of the menu you can quickly jump to a method by name.

Another tip he reminds us about is the “Open Quickly” option (cmd-shift-D). I use this feature frequently, but not in the way he describes. It’s infuriating that when you want to “open quickly,” the dialog for typing in the name of a source file doesn’t tab-complete. Imagine how much more powerful it would be if you could type “MyPic<tab>” and get “MyPictureThingyController.h”. Having to type the whole name of a file in removes most of the quickness. When I use the shortcut, I do so with the cursor inside the quotes or brackets of an include line. When invoked in this context, Xcode is smart and just jumps to the desired header file.

Update: Quentin over at Rogue Amoeba noticed this shortcoming a long time ago, and developed an Xcode plugin to address the problem. Check out Xcode Open Quicker.