Of all the arguments that could be posed against
Cocoa as a compelling framework, NSString illustrates almost all of them. One of the key axioms of object-oriented programming as it was expressed by Alan Kay's Smalltalk could be summarized as "many, many small classes, each with it's own purpose, highly organized into a taxonomy". Between the seemingly inscrutable collection of objects and the class browser, it's a wonder anyone came to grok it at all.
As far as I am concerned, there is only one framework designer who has elevated object-oriented design to the level of art. And his name is Greg Dow. Greg also has roots in class-framework design stretching back into the 80s. Flip open the front cover of the circa 1989 Think-C reference manual (yet another C/OOP hybrid - that's 3, count 'em: Objective-C, C++ and ThinkC), and you'll find Greg Dow's name on the cover. Both Symantec's language business and proprietary mix of OOP/C is long gone
, but Greg went on to design the original PowerPlant framework for Metrowerks and later, PowerPlantX (which I have not yet used). But I'm referring here to his work on PowerPlant, which is splendid.
Designing an effective OOP framework is no easy task. It's hard to do, and it's even harder to do well. And I think I could make the case that it is nearly impossible to do by committee. Usually, the best frameworks come from the minds of one, or perhaps two people, who share a design philosophy and are passionate about getting extremely small details right.
If I were Greg Dow I'd be pondering the lyrics to "what a long strange journey it's been". And for solace, I'd go to kinkos and have the following excerpt from the NSString class made into a poster for my wall:
NSString is so full of garbage it is hard to believe. It's almost as if, during the hard years, NSString maintainance was done by the marketing interns, rather than the computer science interns.
I think they missed one. What about:+(id) stringContainingContentsOfHTTPURLViaPostThroughAnonymizerDotCom:(NSString*)withURL;
It doesn't take a genius to figure out why CoreFoundation is spare where Cocoa is verbose. Everybody learns from experience.
It's unfortunate, but NSString is going to look like this forever. Perhaps, like myspace.com URLs, which are another collision-happy namespace, NSFileSystemPath was cybersquatted by another Objective-C framework designer.
If I had a say in Apple's strategic direction, considering the fact that C++ is well on it's way to becoming the defacto winner in the OOP language wars - (I'm talking about actual standards efforts here, not "standards" that one company invents and says "look it's a standard"
) - I'd hire Greg Dow and give him a wing of 1 Infinite loop, with an indoor tennis court, personal maid, and whatever else he wanted and tell him: make us a state of the art C++ application framework that will make C++ programmers everywhere WET and HARD. Put Apple at the top of the C++ charts. Make C++ programmers lust after Macintosh. Keep it more secret than MacIntel and iPod. Even if it's 3 years away it will still be early in C++ years. C++ and C89 are going to be around forever. They get more work done and they're the only technologies up to the most difficult software engineering tasks - like supporting cross-platform development. I'm sure many people will disagree with me, but that's OK because blogger only takes 1 minute to join. Make your own blog and disagree.
Look, Trolltech is succeeding at selling $3000 C++ application framework seats. I seem to recall NeXT being largely unable to do this. There must be a reason. Think about it. Garbage collection indeed.