Weighing Cocoa and Java
I’ve found a little pet project to work on. It’s an itch of my own that I want to scratch, but I can’t predict how much time I’ll have to devote to it over the long term, so my best bet is open source: release early, release often, and get other developers interested in helping.
After sitting around discussing the idea Friday night in the sitting room of the suite at RMSS, I started playing with ideas on Saturday, using Cocoa. With an example at hand, I wrote the world’s most rudimentary version of one component I’ll need: a simple line-drawing editor. So far it’s been quite easy.
Last night, in about 30 minutes, I duplicated in Java what I’d already done in Cocoa. (I’m not trying to make a point about productivity in Java vs. Objective C … I’m a Java expert who’s just learning Cocoa, and I had already written the app once, so the second try was bound to be faster.) The Java version is cleaner in some ways than the Cocoa version, but messier in others. The Cocoa version is slightly faster, but you have to get a lot of elements in the drawing before you notice a slowdown even in the Java version (and my repaint strategy in both versions is incredibly naive, so there’s a lot of room for optimization). In short: in terms of performance and ease of development, neither Java nor Cocoa seems to offer a compelling advantage. Even memory management is a wash: Cocoa will probably deliver better perceived performance due to the lack of GC pauses, but at the cost of increased development and debugging headaches.
So my thoughts are moving toward platform popularity. I don’t particularly care how widely used the app becomes; it’s my own itch, after all. But I am interested in attracting developers to help. For that purpose, Java seems like the best choice.
For a while, at least, I’ll continue developing these two versions side-by-side. But before long, I’ll have to make a choice. And right now I’m leaning toward Java.