My last post on ideas for improving Cocoa created such a tempest that, given the one-shot nature of blogs, I feel compelled to write a follow up on things I’ve learned, clarifications, and apologies.
 
Let me start with the comment that, above all, made me smile:
 
  1. Rick Altherr
  2. For the record, there are 5 engineers that work on Shark. There are no marketing people or artists. We even write our own documentation. So, yes, the logo is a bit rough on the edges, but we’re quite proud of it.
 
Shark is the main profiling and optimization tool in XCode Tools, the Mac development toolbox. It is, without reservation, one of the finest programs I’ve used in my life. The power, the depth of exploration, the new things lurking for even the most experienced user, the interface, and the documentation are all excellent. I love the Shark presentations at WWDC above all others (with the possible exception of the file system talk I went to last year, my man-crush on Chris Imura being well known among my friends).
 
What I love most about it, though, is it’s so obviously built by engineers for engineers. There are so many facets of it, so many little jokes, that would never survive even the faintest brush with marketeers. Any Shark veterans are probably thinking about the Windowed Time Facility mode right about now. The icon is one of those things that immediately lets this be known. It’s hideous, but it’s famously hideous. It’s the kind of icon an engineer would make. It’s the kind of icon I would make. It is with good-natured engineer-to-engineer ribbing that I call it out as being an example of the lack of Apple lacquer that often comes with the development tools.
 
I don’t love the Cocoa icon. If you’re the artist that made it, sorry. That said, the icon for Cocoa could be a steaming pile of feces with animated flies and that wouldn’t change the fact that Cocoa is wonderful. It is my love, my mistress, my raison d’être. It is what gets me out of bed and keeps me in a hot, crowded, noisy coffee shop for 12 hours a day. It’s important to bear that in mind when you consider my criticisms. I’m not debating that Cocoa rates a 9 out of 10. I’m just working on the decimal.
 
I also love Core Data. It illustrates many of the things that annoy me about Cocoa, but it does so correctly. Things like opacity and taking control away from the developer are dark and dangerous magic, easily abused. Core Data may skirt the edge sometimes, and no doubt there is always room for improvement, but most of the time it does its job with aplomb and uses this bad for good. It is exactly because it is so good that I have so much to say about it, because its usefulness translates into its being used. We spend a lot of time in Core Data, and that’s not because it sucks.
 
It seems to be universally accepted by those responding to my comments on Core Data that it really could do magic with the file system. This limitation is a natural one, and one that Core Data is not responsible for, but overcoming this limitation would make the best so much better. That is really what all this is about. Nobody spends money tuning a car because the car is shitty. An upgraded turbo is not an insult to the person who designed the engine. Even a ridiculous body kit is not meant to be an indictment on the car’s appearance. It is out of love that we hack, never out of hate.
 
Kudos to Mike Ash for standing up for NSCell. He’s given me an appreciation, even a grudging admiration, for the benefits of this nearly universally reviled class. It makes me think maybe it can be reformed. Maybe it is a diamond in the rough that needs and deserves a good bit of attention. I’m willing to give a second chance, but probationary. I reserve my final judgment. I also think it’s telling that there could be such a vehement defense of NSCell, but no one has stood up for ABMultiValue.
 
Perhaps most surprising is how much disdain people have for generics. It’s to the point I wondered if I even knew what generics were. All I wanted was a little extra type checking on my collections. It was Daniel Pasco who laid it out for me in a way I could understand. Static types on collections are just not necessary. Yes, in theory, you might get the wrong kind of class in your array, but in reality, that we use collections for a single class at a time is its own solution. Why clutter up the language solving a problem that doesn’t really exist. I’m inclined to agree. Consider that suggestion withdrawn.
 
The jury is still out on NSCollection. Some people think it’s a great idea, other people think that, like generics, it’s somewhere between unnecessary and the worst idea ever. I can still see the utility of a common interface for what collections have in common, for the flexibility of returning different kinds of collections without backing all the way out to id, and for the possibility of this working, as proved by NSFastEnumeration. If it never happens, I won’t die. It’s a dollop of frosting on an already very sweet cake.
 
The last word on Cocoa I’ll say is about the “broken” interface. Scott Stevenson said, “using the term ‘broken’ in the way Mike does implies that there’s a reference point of some sort for something that is not broken.” I think he was thinking I had another framework in mind that was better than Cocoa in this regard, but in fact my rubric for the “brokenness” of Cocoa’s interfaces is Cocoa itself. The interfaces are not bad, per se. They just have some inconsistencies that have formed organically and need to be ironed out. As I put it in the comments of his blog, these are all things that would be perfectly fine by themselves, but which stick out like misaligned floorboards, ready to trip anyone new to Cocoa. Interface consistency is a stated feature of Cocoa. Let’s stay vigilant to make sure that stays true.
 
Finally, there were a lot of rumblings in the non-Cocoa world about what I thought was so hideous about C# that I didn’t hate even more in Java. I never said anything about C#. I specifically shuddered at C# .NET. I don’t think there’s anything wrong with Java or C# as languages, nor do I think there’s any advantage one has over the other. I think of them as the same language. Indeed, when I took classes in C#, I never bothered to learn C#. I just programmed in Java to the .NET APIs. Yes, there are some minor changes between the two, but for the most part, exactly the same.
 
No, the thing about C# .NET that makes me shudder is that it’s for Windows. I loathe Windows, and the thought of an alternate universe where my love of programming but lack of opportunity lead me to give in to the dark side and become a full-time Windows programmer makes me shudder. I love Objective C as a language, above all others, and I love Cocoa as a framework, above all others, but what I love the most about both of these tools is that they enable me to spend my life doing exactly what I wanted: developing applications for the Macintosh. In that regard, most other tools fall hopelessly short.
 
        Addenda        
 
There were a few comments for this entry, but most of them revolved around people wanting to read comments from the last entry, prompting me to get off my butt and attach them.
 
mikeash

I’m glad you found my comments on NSCell to be valuable. For the record, I completely understand why people don’t like it. The implementation leaves much to be desired. However, I think that this incorrectly leads people to conclude that the design is fundamentally flawed, which isn’t the case. I have no proof of this since I don’t have an implementation of NSView/NSCell which sucks less, but I believe it to be true. Certainly in my own work I have gained a lot of advantage by separating things out into view/cell classes, at least conceptually if not as literal NSCell subclasses.
 
Travis

IMO generics as a language feature removes a lot of casts from your code. That reduces code complexity and gets rid of certain types of runtime exceptions. Generics are easily my favorite feature of Java and I can’t program for JDK1.4 now just because of them. I don’t understand how someone wouldn’t want a language feature like generics that save you trouble, lots of bugs, and is completely optional.
 
Joshua Emmons

@Travis: You’ve hit on the purported purpose of generics. Of course, in ObjC no one casts anything anyway, so there’s not much benefit. Java is much less dynamic (to put it kindly) so generics can be a real time/bug saver there.
 
And is there any way for us to look at the comments on the last blog? It seems as though I missed some interesting conversation, and Alison won’t let me go back in time.
 
Colin Barrett

It’s too bad that Alison doesn’t let you view comments for old entries. I would like to have seen what Mike Ash said (mostly to see how similar his views were to mine, since I recall also posting favorably about splitting views and cells)
 
Ahruman

Yes, this not-being-able-to-see-previous comments thing is a horrible, broken wart that’s somewhat akin to working with Windows in its unnecessary ugliness. Not that I feel strongly about it or anything.
 
Andy Lee
  1. It’s too bad that Alison doesn’t let you view comments for old entries.

Aargh!! That’s annoying.

I too want to thank Mike Ash for his comments. I meant to do so in the previous thread, but Lemur CATTA is such a pain... I started to write a rant here about how much I hate the commenting system, but (a) that would be more appropriate on my own blog, and (b) I would only be driving myself more nuts thinking about it.
 
Andre

Yea, I would like to have seen what Mike Ash had to say... :(
 
Mike Lee

I’ve posted the comments to Make Better Cocoa.

As for the general quality of the commenting system, I hear you. For about an hour of work just to demo Lemur CATTA, I think Alison is pretty effective. Obviously she needs some love, and I’ve got a long list of feature requests to implement when I next have time (i.e., after we ship Delicious Library 2).

Criticisms of Lemur CATTA are, I think, misplaced. Yes, it’s slightly more annoying then nothing, but look how generally insightful the comments have been, even after some serious linking.

That said, if you have some specific yucks about Lemur CATTA or Alison you’d like to make me aware of, you should email me.
 
Dark Side Rulz OK!

Hmmmm, now I feel bad about being Mac programmer who slipped to the Dark Side. Honestly, writing web code in C++ against a random mashup of windows, STL and in house APIs is great fun. Why, just this morning I dealt with having 6 different, and largely incompatible string implementations that must be translated between each call to a different function.

Wheres the exit?!?
 
Jon Hendry

As far as defending ABMultiValue, I’ll just note that, in a way, it is a typed collection, since apparently it is intended to hold multiple properties of the same type. (I could be wrong, I’ve not looked at it before.)

In general, as regards Cocoa and Objective-C, they’re kind of annoying because job searches for Cocoa bring up lots of Cocoa Beach hits and Cocoa (food) hits, while it’s never quite clear how best to search for Objective-C, which often brings up hits for the word ‘objective’.
 
Kim from Zoka gives implementing Cocoa a second try.
Friday, November 9, 2007
Let me Count the Ways