views:

1147

answers:

7

I am eventually wanting to program in Objective-C to write programs for OS X and possibly the iPhone. I do not have any direct experience with C and I come from a web programming background. I am much more familiar with java syntax than C and Objective C.

I am just looking for suggestions on how to get started. It looks like I need to just start with C (I do not yet have a Mac computer powerful enough for programming, so it would be nice to start with C on the Windows platform anyway (information about programming environments would be helpful too, I am used to eclipse)). I am just looking for book recommendations, online tutorials or any other pointers to keep in mind. Keep in mind though that my end goal is to work with Objective-C, so is there anything I need to keep in mind when learning C, anything to watch out for, etc. Thanks for any input.

Update: The reason I am thinking I need to learn C first is that most of the tutorials that I have come across so far for Objective-C assume you already understand C syntax, which I do not fully. Are there better tutorials out there for me?

+4  A: 

If you know java, obj-c will be easy for you (java was influenced a lot by obj-c.) Apple has great documentation, you can start here. I don't think you need to learn C before learning obj-c (sorry Joel).

You can use obj-c on windows if you get gcc. Also check out cocotron:

The Cocotron is an open source project which aims to implement a cross-platform Objective-C API similar to that described by Apple Inc.'s Cocoa documentation. This includes the AppKit, Foundation, Objective-C runtime and support APIs such as CoreGraphics and CoreFoundation.

With all the buzz about iPhone development, there are now dozens of obj-c books. Not sure how good they are, but a classic that I would suggest is Cocoa Programming from Mac OSX by Aaron Hillegass.

lajos
+6  A: 

I don't entirely agree with unwind who says "C and Objective C are different languages". Objective C is a strict superset of C.

Of course he knows that - his point was that you don't need to completely master C before progressing onto Objective C. I'll second that (and hopefully have clarified it).

But I do think it's worth getting some basics with C first, as most introductory texts on Objective C will assume a basic knowledge.

I don't have any recommendations on that myself, but probably most internet based tutorials will be sufficient for that purpose (remember, you're trying to master it at this stage). If you want to take it seriously, then "The C Programming Language" by K&R is the classic text.

When you you can do some basic hello world programs in C, and understand the type system, pointers and stuff - then pick up a copy of "Cocoa Programming for Mac OS X", by Aaron Hillegass. This is a book about Cocoa that covers Objective C along the way, but it one of the best presented coverages of the language. It will assume you are coding on a Mac (it's in the context of Cocoa after all). You may be able to follow the pure language stuff using GCC on Windows, but I wouldn't recommend it.

If you're going to be working on a Mac eventually, then best to do it at this stage, IMHO. You say you don't have a Mac "powerful enough for programming", but anything that can run OS X would be fine to get your started.

Phil Nash
+1  A: 

I'd say that it's better to learn C first. be sure to approach it like what it is: a structured machine language.

when you feel comfortable on it (no need to really master it), go on to Objective C, where you'll rediscover several things familiar from Java, but knowing the C infrastructure will make more apparent when they're similar but not equivalent.

it's very important not to learn a language using what you already know as a 'metaphor' for the new. always try to pretend you didn't know anything before.

Javier
+1  A: 

I don't know what you mean by a Mac powerful enough to do programming on (any Mac should do), but get yourself something at least marginally useful as a development system soon. (You may well have the development system on one of the CDs that came with your Mac, or alternatively you can download it from Apple.)

The sooner you get Xcode working, the sooner you'll be comfortable with it.

David Thornley
+2  A: 

Programming in Objective-C by Stephen Kochan is what you want. It assumes no programming experience but doesn't hold you back if you do and introduces the whole thing, C with the Objective-C superset, as a complete package. I read the first half of Kochan (the second half gets into Cocoa) and now I'm working on Cocoa Programming for Mac OS X (3rd Edition) by Aaron Hillegass and reading Kochan was a massive help. Those two are a "one-two punch" that will get you going in no time.

Have a C and Objective-C reference handy as Apple's docs of C in XCode pretty much sucks from what I've seen so far. K&R's C text is like the Encyclopedia Brittanica of C and, just like a set of encyclopedias, isn't for everyone. I've just been Googling for references and generally find what I need on the web since C is so ubiquitous.

You'll burn through a couple of books before you find the set that best fits you, but you simply can't go wrong with Kochan and Hillegass for Objective-C and Cocoa. By the time you finiah the first couple chapters of Hillegass, you'll want to (and be able to) start writing some stuff on your own.

Philip Regan
+2  A: 

There is a recent blog-entry at Tuaw: http://www.tuaw.com/2009/01/15/starting-out-with-objective-c/

Steilpass
thanks, that will be a help.
Ryan Guill
+1  A: 

I have recently started to learn programming for the Iphone and tried many differenet books until i found these helped me the most (I would also strongly recomenned getting a mac since the Xcode is the way to go when coding for Iphone):

To note all these books have the same author and thus the traceability is great! The books have crossreferences between each other that really helps.

Mikelangelo