Sun 26 Dec 2004
Category : Technology/CocoaBindingsAndJava.txt
I'm trying to understand Cocoa Bindings, to see if I can write less code. My starting point is Michael Beam's O'Reilly article, "The Cocoa Controller Layer". I've been playing around with extending the sample code and it's starting to become clearer - like when and how to step in and do custom things, like interfacing with a database.
This will make a great demo (of the jaw-dropping kind). But my databases are all accessed through Java JDBC drivers, and we've got tons of Java code I'd like to plug into. So, I started on a Java-Cocoa version and got things to the point where the Table View shows the right data but the application crashes soon after.
Reminds me of Aaron Hillegass' "Don't write Cocoa applications with Java" comment. It's a fair point. But you may have code that already work well in Java - modelling the business rules, putting stuff in and out of databases, running off web servers, and providing web services - and that's often the case in the enterprise.
It's possible to map out a large enough part of the Cocoa framework to allow Java programmers to work safely and predictably, putting Cocoa front-ends on top of their Java code. You don't have to be able to build things like Create and OmniGraffle. Enough of Cocoa already work well in Java to allow us to do productive things with it. If that could help us bring a lot of that enterprise data onto the desk of Mac users, wouldn't that be a good thing?
Downsides to Java-Cocoa at the moment - like poor documentation, bugs, and lack of speed - ought to go away with time. It shouldn't stop people doing Cocoa using Java.
But back to Cocoa Bindings. Other good sources of information include "Introduction to Cocoa Bindings", "Cocoa Bindings Examples and Hints", and the "Cocoa Bindings" discussion at cocoadev.com. I'll put up more links when I find them.
I'll leave you with another comment from Aaron Hillegass. Cocoa Bindings look great in demos, but may be less than useful in practice. However, this is a most interesting development with a lot of potential. Hope Apple continues to build on it.