3 ms·
API is a very important aspect of a platform, so I think "API bitching" is still valid complaint. Improvements in Cocoa Touch make parts of Mac Cocoa look old
by pornel 16y ago
API is a very important aspect of a platform, so I think "API bitching" is still valid complaint.
Improvements in Cocoa Touch make parts of Mac Cocoa look old and needlessly complicated. That's definitely a problem that needs addressing.
Categories can patch some of that, but you still have to write ugly code once, and categories are not as elegant as fix in the API itself (e.g. you have to use odd/prefixed method names in categories to avoid collision with potential future API).
- pmjordan 16y agoImprovements in Cocoa Touch make parts of Mac Cocoa look old and needlessly complicated. That's definitely a problem that needs addressing. If this is a major general point, it should probably be explained as such; picking 4 specific examples and discussing them as free-standing, independent issues didn't convey a greater issue of "the Cocoa interfaces are too verbose for 95% of use cases" to me. If it's literally 4 methods, even namespace-prefixed category extensions seem a pretty attractive option to me. Granted, clarifying that would have reduced the list to 9 points rather than 12, making it 25% less linkbaity.
- alextgordon 16y agoCategories can patch some of that, but you still have to write ugly code once, and categories are not as elegant as fix in the API itself (e.g. you have to use odd/prefixed method names in categories to avoid collision with potential future API). If the API is really obvious then this doesn't matter, since the category will simply replace the API method with something that does exactly the same thing. For example, there's no real need to prefix a category implementation of -cgColor because it couldn't conceivably do anything else. If it really bothers you, then you can use the runtime to load methods into NSColor, first checking to see if they exist.