RdFT
The Best of Apple News Rumours and Mysterious Comings and Goings
0x00000000.net
Sunday, October 15, 2006
Mac: Speaking of pathnames and Cocoa

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:
- stringByDeletingLastPathComponent
– stringByDeletingPathExtension
– stringByAppendingPathComponent:
– pathExtension
– stringByDeletingLastPathComponent
- stringByExpandingTildeInPath
– stringByAbbreviatingWithTildeInPath


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.

Tags: apple | cocoa | carbon
By : NeXT!0x0000DEAD Speaking of pathnames and Cocoa

1 Comments:
Blogger cjwl said...

While I would agree that NSString doing double duty as a path, i.e. file reference, is the first thing a beginner might notice as questionable design, NSCell is a far worse class to deal with on many levels.

8:37 AM  

Post a Comment

[ Home ]

 

 
 
 

 [Site Map]    
 Apple News    
 Opinion    
 Cocoa Programming    
 Reading List    
 About    
 Home    
 Reality Distortion Field    
 latest apple news iphone    
 latest mac apps news    
 ipad latest news apps    
 iSight Download    
 Best WebCam    
 Screen Capture    
 


Copyright © 1996-2006
All Rights Reserved
RdFT

search this site only.