Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

andysmith

macrumors 6502
Original poster
Sep 24, 2004
342
0
West Mids, UK
I'd really like to create some apps for OS X, but I'm not sure where to start.
I've never use C or C++, and I've only got a basic grasp of object based programing, mainly from PHP.

Are there any books or tutorials that I can use?

Thanks for any help :)
 

jeremy.king

macrumors 603
Jul 23, 2002
5,479
1
Holly Springs, NC
andysmith said:
Thanks :)
This book looks good:
http://www.amazon.co.uk/exec/obidos/ASIN/0321213149/qid=1096808524/026-9618200-5489267
But it says it's for people who have knowledge of C++ - is that essential? Where would I start out with that?

With the other book recommendation :)

http://www.amazon.co.uk/exec/obidos...23800/sr=1-1/ref=sr_1_8_1/202-3056260-2575813

You really need to understand OO &&/|| C/C++ if you want to get a good understanding of Obj-C and Mac development. I must say so far, I like the book. I have cruised through the first 8 chapters so far and am trying to follow along with all the examples (especially the evolving Fraction class) using my interim system (a PC :( ) running Cygwin's gcc compiler and jGrasp (thanks bousozoku)
 

andysmith

macrumors 6502
Original poster
Sep 24, 2004
342
0
West Mids, UK
kingjr3 said:
With the other book recommendation :)

http://www.amazon.co.uk/exec/obidos...23800/sr=1-1/ref=sr_1_8_1/202-3056260-2575813

You really need to understand OO &&/|| C/C++ if you want to get a good understanding of Obj-C and Mac development. I must say so far, I like the book. I have cruised through the first 8 chapters so far and am trying to follow along with all the examples (especially the evolving Fraction class) using my interim system (a PC :( ) running Cygwin's gcc compiler and jGrasp (thanks bousozoku)
That book looks good - so can I just use the examples in that OK with the XCode tools?
 

logicat2001

macrumors regular
Apr 16, 2003
192
0
Minneapolis, MN
I'd strongly recommend the Aaron Hillegass book and forget about the "Programming in Obj-C" until later, or pick them both up simultaneously. Aaron's book deals more with the Cocoa frameworks, while Programming in Obj-C deals with, well, Obj-C. Obj-C is a superset of C; that is, it's exactly 100% the same as C with a tiny handful of additions (I think it adds one or two basic data types, and one new operator. It's amazing what Brad Cox, the guy who designed Obj-C, was able to accomplish so elegantly and simply.) However, if you're going to focus on Cocoa programs, you'll be spending alot of time trying to figure out how the frameworks are structured, and how best to utilize the powerful functionality therin. Yes, you will bump up against lower-level C programming, but it'll probably be infrequent until you start to grasp what you can accomplish within the Cocoa frameworks alone.

The Hillegass book mixes enough theory, training and walkthroughs to lay some basic concepts down while giving you a grand tour of the Cocoa frameworks. Even if you don't understand everything in it, you should enjoy the process without getting frustrated. However, this isn't some watered-down, programming for dummies material. Aaron's been working with these frameworks long before Apple purchased Next computers. Here's a quickie bio:

Aaron has over 18 years of experience as a software engineer and developer trainer. He wrote the Big Nerd Ranch course on Cocoa, drawing from his experiences working at Apple Computer, Inc. and NeXT Software, Inc. as the senior trainer and curriculum developer.

Aaron is the author of "Cocoa Programming for Mac OS X." This book, published by Addison-Wesley, is generally regarded as "The Book" from which to learn Cocoa programming. He is also the co-author of Core Mac OS X and Unix Programming.

Aaron has developed and deployed very large systems using Cocoa, WebObjects, and/or PostgreSQL for clients including Cogent Design, Nortel Networks, and the United Parcel Service. He has taught at the University of Washington and the New College of Florida.

Bottom line: remember that it's completely AOK to be confused when learning. That's part of the process and if you weren't confused and challenged, I'd be concerned that you weren't learning much of anything. It all depends on your learning style. If you can, see if you can locate them at a local booksellers and browse first.

Best,
Logicat
 

andysmith

macrumors 6502
Original poster
Sep 24, 2004
342
0
West Mids, UK
Thanks - very helpful :)

I'll have a look for the books locally then - probably not for a while, I need to finish reading 'Mac OS X Panther in a Nutshell' (I want to fully get to grips with OS X first).
 

bastardx

macrumors member
May 16, 2003
33
0
Eugene, OR
As someone that has come from more of a Java background to Objective-C, I have one piece of advice: read carefully about memory management. This is very important for the transition from a language that is fully garbage collected(meaning when you create new objects, you don't have to delete them manually), to a language where you have to be more responsible with your memory usage.
 

logicat2001

macrumors regular
Apr 16, 2003
192
0
Minneapolis, MN
And regarding memory management in Cocoa, it's not confusing once you learn it. Also, it's nothing like the low-level management of memory in C.

There are two or three simple rules that, if followed, will prevent you from needing to worry about memory management and object persistance. Again, Hillegas' Cocoa book lays it out very simply.

The other Cocoa book that has proven itself invaluable is "Cocoa Programming". It's my go-to book for answers to specific Cocoa implementation questions; there's not much in the way of tutorial work included. Different chapters cover specific classes, programming methods, and Cocoa philosophies. It's really a fantastic reference, and the most explicitly helpfull one I've seen.

The only drawback of the 1st edition of "Cocoa Programming" is it only covers the API through 10.2. The 2nd ed. of Hillegas' book, now available, covers the bindings and controller additions of 10.3; an area that will radically change your programming methodology (as long as you expect to only release your software for 10.3 +).

Best,
Logicat
 

iCreate

macrumors member
Sep 2, 2002
99
11
Near Insanity
logicat2001 said:
I'd strongly recommend the Aaron Hillegass book and forget about the "Programming in Obj-C" until later, or pick them both up simultaneously.

I picked up Hildegass' book both editions and find that they weren't all that helpful. Yes you simply type what is there and get the results he has, but without the underlying foundation in Objective-C most will be lost.
"Programming in Objective-C" by Stephen G. Kochan is the best for learning the language and he also guides you into the Foundation framework. Once you understand this Cocoa is a snap. Starting at the other end and working your way back is confusing to everyone I've come across that starts programming for OS X this way. So I recommend andysmith go with "Programming in Objective-C" it's a must and then find a good Cocoa book. I don't find the Hidegass book all that friendly to noobs.
 

blueknight

macrumors newbie
Oct 18, 2004
10
0
Getting to grips with OOP

If you have only done PHP then you might need to learn about OO programming, this site has a great introduction to OOP mainly aimed at Java developers but concepts work in Obj-C.

http://sepwww.stanford.edu/sep/josman/oop/oop1.htm

If you find tutorials for Obj-C hard to find try just learning C as 90% or more will work in Obj-C, in fact many languages can work in Cocoa making it very cool indeed!

Actually you don't even need to do C, C++ or Java or Obj-C... you can make a pretty decent app using Applescript - check out the Apple developer site for more info
 

macfreek57

macrumors 6502
Jan 1, 2002
379
0
Baton Rouge, Louisiana
if you download apple's developer tools, they should have a very fairly good tutorials. i downloaded the version they had about a year and a half ago and the included tutorial was pretty helpful. of course buying one of those books will probably be better, just not free (how i like things :D ).
 

netytan

macrumors 6502
May 23, 2004
254
0
blueknight said:
If you have only done PHP then you might need to learn about OO programming, this site has a great introduction to OOP mainly aimed at Java developers but concepts work in Obj-C.

http://sepwww.stanford.edu/sep/josman/oop/oop1.htm

If you find tutorials for Obj-C hard to find try just learning C as 90% or more will work in Obj-C, in fact many languages can work in Cocoa making it very cool indeed!

Actually you don't even need to do C, C++ or Java or Obj-C... you can make a pretty decent app using Applescript - check out the Apple developer site for more info

Agreed, Applescript can be a good way to create small Apps, but I can't see myself - personally - using it for anything more than my own little utilities.

On the subject of learning OOP you might want to look at Python. Besides Python being easy to pick up there’s also much more documentation on Python than there is Applescript. And since Python and Obj-C classes share the same roots - Smalltalk – you might find it of more use to you.

Where as you might find classes in Java and C++ are a little different; they are more like PHP classes!

Conceptually though, the ideas behind OOP are language neutral. Still, I think worth mentioning. But then I am pretty new to Cocoa myself :).

Have fun,

Mark.
 

jsw

Moderator emeritus
Mar 16, 2004
22,910
44
Andover, MA
I'm also new to the whole "Mac programming" thing. At least on anything since System 7. Coming from a strong Java background, it's requiring me to unlearn some stuff and has reinforced just how common basic OOP concepts are in other areas.

I agree that Hillegass' book ("Cocoa: Programming for OS X") is a great (and thorough) intro to Cocoa. "Cocoa Programming" is also good, but just a bit cumbersome IMHO. However, I don't see any way around getting Kochan's "Programming in Objective C" concurrently with Hillegass.

From my point of view, Cocoa provides you the keys to the GUI kingdom. Using Hillegass' examples, you'll learn to do most of what you need to learn in order to build a GUI, complete with interactions between components and with the user.

However, to actually do anything aside from GUI logic, you need Objective-C (unless you punt and use Java to fill in the gaps... as I've been guilty of doing). And Kochan's book is an excellent intro to that language - and it doesn't require familiarity with any language first (he starts at the beginning and teaches Objective-C, as opposed to assuming you're coming from C or C++ or Java or whatever background).

Before using Java, I used C++ for many years, and C before that. While I agree that Objective-C often looks like C (of course, since it's a superset), the differences are enormous in terms of how you use the language. Kochan does a great job of explaining it.

As far as AppleScript: it's great for inter-application glue. It's good (but often tedious and mystery-prone) as a simple way of interacting with apps. But it's not as good as Python, Java, Objective-C, shell scripts, or really any other approach when you're not directly trying to tell other apps to do things. It's good to know, and very, very useful in its defined area, but not a great general programming tool.
 

hotwire132002

macrumors 65816
Jan 24, 2004
1,209
1
Cadillac, MI
I'm also trying to begin cocoa programming--is there a good online tutorial anyone can point out? The only link I saw in this thread was at the beginning--and I skimmed through it, but didn't see anything that looked great.

By the way--I'm completely new to (any form of) C, so I need something that doesn't assume I know C.
 

logicat2001

macrumors regular
Apr 16, 2003
192
0
Minneapolis, MN
Start at CocoaDevCentral for a pile of Cocoa articles (also compiled from Stepwise) and links to other reference material and tutorials.

Other than that, start reading and coding. If you want to learn how to cut code, just start cutting code.

Best,
Logicat
 

hotwire132002

macrumors 65816
Jan 24, 2004
1,209
1
Cadillac, MI
logicat2001 said:
Start at CocoaDevCentral for a pile of Cocoa articles (also compiled from Stepwise) and links to other reference material and tutorials.

Other than that, start reading and coding. If you want to learn how to cut code, just start cutting code.

Best,
Logicat

Thanks for the help. I'll check it out :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.