|
|
Riffs on Thoughts about large Cocoa projects
Brent Simmons shared a few thoughts on managing largish Cocoa projects. Here’s my riffs off his notes:
Agreed: you should treat notifications like they’re a last resort, especially in application code. Think of the common notifications you deal with, and you’ll realize they originate from Cocoa. There’s a reason for this: notifications are a way to couple very independent classes. As in: classes that will be written a few years from now. Think of your Cocoa application as a layer cake: Foundation at the bottom, AppKit in the middle, your code on top. It’s OK for higher levels to know about and use lower levels, but not going the other way. By keeping the lower levels ignorant of its clients (the higher levels), you keep them reusable. Most of the time you’re using notifications, it’s because of this architecture. The great part is that AppKit is highly reusable. The downside is since AppKit has no idea about how its being used, it has to use this highly generalized mechanism to communicate with its client. (Fortunately, Cocoa often codifies the general notification mechanism through an explicit delegate pattern (i.e. So unless you’re writing a framework that can have multiple clients, you probably are better off sending messages directly.
Yup: KVO is magic. Use it sparingly outside its standard UI-binding domain.
I do the same thing. A couple of other things that sometimes get “wait! how did you do that?!?” reactions at PSIG and CAWUG:
I’m even worse: all the source goes right alongside the Parroting Brent, keep things flat as possible. Never beyond two levels deep. Smart groups and the search box makes it easy to slice through even large projects, so don’t waste time setting up and maintaining elaborate hierarchies. Half your team will just disagree with those hierarchies anyway, but everyone appreciates a singular (but searchable!) mess. Wednesday, April 25, 2007
|
Contact Me Topics RSS Feed Linkblog
Bill Bumgarner Brent Simmons Daniel Jalkut Dave Dribin Eric Albert Eric Rescorla Eric Sink Greg Miller Gus Mueller Jeremy Zawodny John Gruber Mark Dalrymple Michael Tsai Peter Ammon Raymond Chen Ryan Wilcox Scott Stevenson Steven Frank The Daily WTF we hates software Wil Shipley |
Copyright © 1997-2008 Jonathan 'Wolf' Rentzsch. All rights reserved.
Questions? Comments? Contact Me.