The Blog

Jan 3, 2008

Cocoa is a Series of Tubes 

by Maxim Porges @ 9:42 PM | Link | Feedback (2)

My mum (English spelling) got me a Cocoa book for Xmas off my Amazon wishlist (donations gratefully accepted). I already had another Cocoa book, but this one seems far more immediate.

I'm on Chapter 5, learning about Delegates. It's interesting because we decided to call the primary remote Java object in our Flex apps at CFI Delegates, too, and they fulfill very similar responsibilities (although in entirely different ways due to the technology differences).

I've now grasped the concept that, unlike the Internet, Cocoa is a series of tubes. Messages can go from anywhere, to anything. One object declares itself responsible for handling events for another (as its delegate) and Cocoa doesn't complain. Objects pass themselves to each other with no regard for type or compile-time checking. There's an element of trust involved that I simply don't count on myself to be able to provide to XCode. Sorry, XCode.

For a Java developer, it's both liberating and intensely terrifying at the same time. Of course, this isn't my first experience with dynamic languages so I knew what I was getting in to, but I find it interesting that such a beautiful and stable OS as OS X would be written largely in such a strange (read: trusting and uncompiled) beast of a language.

I look forward to later chapters in this book and the next (also provided by mum) where I will learn just why this kind of flexibility is what Cocoa developers are always gushing about on mailing lists.