Difference in Mac Cocoa and iPhone Cocoa

One advantage in developing iPhone applications for existing Mac programmers is that it uses same language, same framework, same programming model and same programming style.
It is true.

However, there are some subtle differences between the two environment.
While I was watching iPhone Application Programming video podcast from Stanford University, I got to realize that there was a subtle but very important difference in Hello, World program.

Almost all Cocoa / Objective-C programming books start to explain about how easy it is to write Cocoa/Objective-C. They provide some examples for which you don’t need to write even one line. For example….

  1. Place a NSSlider instance on a window using the Interface Builder
  2. Place a NSTextField instance on a window
  3. Control-Drag from the NSSlider instance and drop to the NSTextField instance.
  4. Then, the Interface Builder presents a pop-up window which shows methods like “takeIntValueFrom“. Choose it.
  5. Now, the NSTextField instance takes int representation of current slider value
  6. Build your app and run it.
  7. While you slide the NSSlider instance, its value keeps being displayed in the NSTextField instance.

takeIntValueFrom for Mac

However, with Cocoa for iPhone, it is not possible. The UIControl class doesn’t have methods like takeIntValueFrom:. So, you can’t connect NSSlider value to an NSTextField instance using the Interface Builder.

No takeIntValueFrom

So, you should write some lines of codes for the iPhone/iPod touch.

“No need to write even a single line” was big sales point of Cocoa, when Steve Jobs demonstrated its capability. He did such kind of demonstration in the early days of Mac OS X.

However, with introduction of iPhone SDK, many strong points of Cocoa doesn’t seem to exist. Apple Inc. doesn’t provide difference of iPhone and Mac development in this depth.

Are they experimenting a new programming model with the iPhone SDK? Or isn’t the iPhone SDK as mature as that for Mac yet?


2 responses to this post.

  1. Posted by Frank on July 20, 2010 at 12:01 AM

    I’m always wary of ‘no need to write code’ kind of promises.

    If you want to write a meaningful app, on Mac, iPhone or anywhere else, you’ll need to write code, and probably lots of it.

    I think the Interface Builder does a great job though, the best visual UI builder I’ve encountered


    • Posted by jongampark on July 20, 2010 at 6:16 AM

      Sure, why not.
      But IDE manufacturers look to like that kind of propaganda.
      Google recently announced a development tool for people who doesn’t know how to code with such a propaganda also.

      Problem is that there are many people who want to believe it. :)


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: