Tuesday, November 25, 2008

Cocoa and iPod Touch

Yesterday's post was a very popular post. Maybe it's because I've been neglecting this blog. Anyhow, I got my iPod Touch because my sister is a college student and my Dad bought her an iMac when Apple had their last back to school promotion. So I was pretty stoked to get a free to me iPod touch even if it's the older generate and 8 gigs.

t's an awesome little device. So I started learning Objective C and Cocoa last Wednesday evening. It takes a bit to get your head wrapped around Objective C, but once you get in the right mind-space it's pretty clear. At first it looks like C with a bunch of garbage. Then you start seeing how the C is decorated with the objective part and bam, your in the mind-space that's required to program in Objective C.

When I get into a new language/framework I try to pick something interesting that I want to create, even if I don't finish it, just to have a goal. I then try to figure out how the language and framework are designed so I can understand the advantages of the platform. For instance something I find interesting about Objective C is all method calls of objects are actually messages that go through a dispatch mechanism. Every time the compiler encounters a method call of the form [objectInstance func] the compiler replaces it with a C call to objc_msgSend. This means that method calls on an object in Objective C are a bit slower than a virtual method call to an object in C++ or Delphi.

My little pet project that has turned out to be a lot more work than I anticipated is to port DCannon2 to the iPhone. In toying around with the OpenGL ES I've had to modify much of the existing OpenGL code since things like glBegin and glEnd are removed for performance reasons from OpenGL ES. But DCannon for the iPhone is coming along.

No comments:

Post a Comment