views:

1133

answers:

7

Actually I don't care too much about Mac OS X development. I want to do only iPod Touch and iPhone development. But anyways, I started learning Cocoa and Objective-C. But it seems like there are many differences between Cocoa and Cocoa Touch, so I am wondering if I am actually wasting my time. Should I just jump directly into iPhone topics?

+10  A: 

There is lots of overlap, but if your purpose in learning is to do iPhone programming, then by all means learn iPhone programming directly.

As a side-effect, you will be able to pick up Mac application programming more easily if you should ever have such a desire.

Paul Robinson
The other advantage of this approach is that iPhone programming is basically a subset of Mac programming. Going the other way would require to you to figure out what is gone.
Andy
@Andy: not quite. Some APIs on iPhone are cleaned up compared to Mac Cocoa. You can see that lack of backwards compatibility issues allowed Apple to rethink (or at least rename) few things. The result is that you'll be stumbling into small diferences both ways.
porneL
+8  A: 

I think you could go either Cocoa-Cocoa Touch or Cocoa Touch-Cocoa and still have a good grasp on what it takes to program for either platform. I tried Cocoa development on my Mac a few years ago and was pretty confused. I finally decided to take up iPhone programming, and picked up Beginning iPhone Development: Exploring the iPhone SDK, worked through that book over a few weeks, and I understand things much, much better now. Really, all it takes is a good explanation of Mac programming. I'm fairly confident I could pick up regular Cocoa programming with far less effort now. Had I started with regular Cocoa programming, I'm fairly confident I would have been able to pick up iPhone programming fairly easily. There are differences, but there are a lot of (very cool) similarities between the two platforms.

PS, I highly, highly recommend that book if you're really interested in iPhone development. It was worth every penny.

unforgiven3
+3  A: 

There are similarities but if the goal is iPhone development, you'll be much better off starting to learn on that platform and then stepping up to the Mac. There's a lot more going on both in the UI frameworks, and in terms of what IB can do so you may well get used to some aspect of the system that is not present on the iPhone (or done differently).

The NS foundation classes are much the same but even there are differences.

Also beware that the simulator will compile and run Mac code that will not compile or run on the phone itself, when using the docs always keep them focused on the iPhone SDK section.

Kendall Helmstetter Gelner
what do you mean by "when using the docs always keep them focused on the iPhone SDK section"?
Thanks
On the left side of the Documentation window, you can select different documentation sets. You can be looking at the Mac OS set, or the iPhone set (in fact multiple versions), or I think everything. By default I think you are looking at the OS X set which has elements you cannot use on the phone.
Kendall Helmstetter Gelner
+7  A: 

Normally I would agree with the other answers here: directly learn the topic you're interested in. But in the case of Cocoa/Cocoa Touch, you'd be better off reading Cocoa Programming for Mac OS X, 3rd ed. by Aaron Hillegass. It's just that damn good!

dodgio
It is a good book but it's not necessarily better than Beginning iPhone Development for this purpose.
Roger Nolan
I'm currently reading both books, but I think I will focus on the iPhone now. Aaron's chapter on memory management confused me some and he doesn't like using properties, which is used extensively in the LaMarche book. Little things, but they bug me enough to make me focus on one or the other.
kirk.burleson
+3  A: 

One difference between Cocoa Touch and Cocoa is in the area of memory management.

If you happen to be learning Objective-C for the very first time (or possibly any C-based language for the very first time) I would start with Cocoa Touch.

My reasoning is that the iPhone does not support automatic garbage collection, and you may find it easier to learn the (more difficult? certainly less automatic) way first, then as you migrate to OS X development appreciate the shortcuts that the OS X platform gives you.

If you learn Cocoa development on Leopard initially, you may be frustrated at the seemingly more primitive memory management available in the iPhone.

The two are very similar, though.

Bottom line is if you want to learn to program for the iPhone, go ahead and jump to the iPhone. Mac OS X development is not a prerequisite, just a very similar skillset.

mmc
+1  A: 

I've taught Mac developers and iPhone developers, and my experience is that it's generally best to learn Mac first, particularly because you can get a solid grounding in Cocoa using Cocoa Programming for Mac OS X, which is still the best book on learning the Cocoa patterns around. So far I haven't found a good iPhone book that teaches the key issues you need to know, and that differentiate Cocoa/Touch programming from Java, .NET and other systems. I've written a couple of articles recently that may be helpful as you think about this:

iPhone Course Syllabus

Review of iPhone Developer’s Cookbook

Rob Napier
Thanks for the links!
kirk.burleson
+1  A: 

I've went through about the same question as you, though my initial focus was more on Mac development, the iPhone came later. I'm by no means an expert cocoa coder yet, but things are improving rapidly. I find that the things I learned about cocoa on the Mac come in quite handy on the iPhone; picking up iPhone development certainly went a lot quicker than my first steps in cocoa on the Mac...

In practice, I find both skills come in handy. I'm making an iPhone game, but the data set it uses (the actual puzzles) are created using a small cocoa app I've developed for the Mac. Is there a specific reason why you don't want to learn Mac development? You don't need additional development/designing tools for your game?

(screenshot of the mac app: http://www.qixis.com/images/edit16-screenshot.png)

Emiel
Please update your link.
kirk.burleson