got net?

Kevin Hazzard's Brain Spigot

About the author

Welcome to Kevin Hazzard's blog.
E-mail me Send mail

Recent posts

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010

First Impressions of Cocoa

I attended the Richmond .NET User Group meeting tonight and listened to Jon Pryor talk about The Mono Project. He did a great job and answered some of the questions I have had for a while about how to get started with Mono. Feeling a bit saucy from the ALT-ness of the experience, my friend Harper Trow said he was going to run over to IronWorks to attend the second half of the CocoaHeads User Group meeting. Sixto Saez, Harper and I found our way into the fairly crowded small conference room where a group of twenty and early thirty-somethings were discussing Cocoa Bindings. I am not a Mac OS X developer. But I am curious about other platforms and OS X has some compelling concepts.

The Richmond CocoaHeads are an interesting group of folks who are clearly committed to their framework and platform. I am a Microsoft guy to the core but it's really good to be among any group of technologists who so visibly love what they do. Having never seen Cocoa and the Xcode development environment before, I had to draw on prototypes from my C++, Java and .NET experience for figuring out how Xcode works in principle. It felt a lot like Visual Studio done Apple style: prettier and maybe a bit more attention to the details.

The one thing I saw in Cocoa that was quite interesting was how Cocoa Bindings implements the Observer Pattern for notifying user interface elements of property changes. Whenever some client code registers for change notifications on a property, the Cocoa Bindings code inserts a proxy at runtime that fires the pre and post events before and after the state change. Pretty cool stuff. This trick is essentially applying the Interceptor or Composition Filter pattern that I've been using in AOP for years but performing it dynamically at runtime. On the one hand, it's pretty cool to see these patterns applied in such a dynamic way. But it seems to tie Cocoa Bindings to Objective-C's object model so tightly that I can't imagine being able to use anything else to do OS X development in the future. It would be hard to introduce another dynamic language, for example, that didn't conform to Objective-C's runtime model for proxying the observed properties. I could be wrong on this but it was my first impression. And my first impressions are usually pretty accurate. What are your thoughts? Can you offer more insight?


Tags:
Categories: Software Dev
Posted by kevin on Thursday, January 08, 2009 10:38 PM
Permalink | Comments (7) | Post RSSRSS comment feed

Comments

Marius Filip Romania

Friday, January 09, 2009 1:18 AM

Marius Filip

I am not sure whether dynamic change of an assembly is possible in Mono, but I've seen tools for MS .NET that inject code into .NET methods for other purposes (such as performance profiling) so that I believe such approach might be possible into a .NET-like environment as well. Obviously, Objective-C is the natural choice.

Kevin Hazzard United States

Friday, January 09, 2009 12:16 PM

Kevin Hazzard

Marius: I have been writing dynamic code in .NET for a long time. Since the .NET 1.1 Framework, there have been fantastic reflection and IL generation capabilities in the platform. This is why you see so many AOP implementations that do method interception available on the .NET platform. It's not all that difficult to do in .NET. My concern when I looked at how Cocoa Bindings did the interception was the way it tied the framework so closely to the Objective-C language. Having worked in the JVM and the .NET CLR for a long time, I appreciate having a layer of indirection/interpretation between my code and the machine. The way that Obective-C intercepts property mutators to fire change events is way cool. But it's tied to the runtime and the binary implementation that Objective-C uses. Fundamentally, this isn't a good idea. It's what made COM difficult for Microsoft to sustain. I just wonder if Apple and its developers will regret in the future what seems cool today.

conference-calling.eu

Saturday, January 17, 2009 3:39 AM

pingback

Pingback from conference-calling.eu

First Impressions of Cocoa | CONFERENCE CALLING

Chris Stewart United States

Monday, January 26, 2009 8:48 PM

Chris Stewart

Kevin,

You may find my site useful if you continue down the iPhone development path: http://www.iphonedevsdk.com

Home grown in Richmond, VA. Smile

Chris

Kevin Hazzard United States

Tuesday, January 27, 2009 8:04 AM

Kevin Hazzard

That's great Chris. Right there under my nose all along. Great site. I will be doing some iPhone development soon, I think. My company may be getting me an iPhone 3G to build some applications that integrate with Microsoft Dynamics CRM. I am building the services for a prototype now. Hopefully, I'll get the chance to work in Cocoa using XCode. It looks like fun! I'm going to try to make it to the next CocoaHeads meeting in Richmond. Second Thursday of the month. Hope to see you there.

Chris Stewart United States

Sunday, February 01, 2009 11:11 AM

Chris Stewart

That's awesome Kevin!  Glad to see CapTech doing some iPhone work.  I worked at CapTech on the Microsoft team in 2007.  Great bunch over there, for sure.  Maybe I should let Darrell know I'm into iPhone development... Smile

Kevin Hazzard United States

Monday, February 02, 2009 2:02 PM

Kevin Hazzard

Chris: You definitely should talk to Darrell. We have more iPhone work on the horizon I believe.

Comments are closed