5 Replies Latest reply: Jan 19, 2010 4:35 AM by Tron55555
jakudo Level 1 Level 1 (0 points)
Hello all,

I would like to ask you what is the best way how to start learn programming in cocoa? Is the best to learn C or objective C or directly cocoa first?
How can I start to learn it?

Thanks a lot!

P.S.: I don't have any experiences with programming, just some basic commands in C but I wanna learn it a bit because it can help me a lot in my studies.

MacBook Pro 15.4'', iPhone 3G, Airport Express 802.11n, Mac OS X (10.6.2)
  • K T Level 7 Level 7 (23,700 points)
    Seen this?
    K T - iPhone Developer Beginner Resource Guide (Nov 1, 2009)

    Also another 'Getting Started' resource that just came out recently:

    As well, the 'Stanford University iPhone Application Development' classes for Winter 2010 started recently.


    Lecture #1, 'Introduction to Mac OS X, Cocoa Touch, Objective-C and Tools' and Lecture #2, 'Objective-C and Foundation Framework / iPhone Application Development' might be of interest. Lectures 1 & 2 are available via iTunes now. #4 was held 1.15.10 - lectures are typically available via iTunes one week later.

    http://deimos3.apple.com/WebObjects/Core.woa/Browse/itunes.stanford.edu.31244300 53.03124430055.3145764870?i=1399672464
  • jakudo Level 1 Level 1 (0 points)
    waw! that's great. Thank for the links!
    The lectures seems to be very good
  • Tron55555 Level 2 Level 2 (180 points)
    Hey there. You're the third person in the last few days to ask this question, but it's a good question to ask, so I want to try to answer it. I've gotten a bit lazy, though, so I'm going to just give you the same basic response I gave in the previous threads since it will all apply to you just as well as it did for them. Here goes:

    Learning to program for Mac or for iPhone is a three step process. The first step is to learn the C language. The second step is to learn the Objective-C language, and the third step is to learn the Cocoa framework (if you want to develop for Mac) or the Cocoa Touch framework (if you want to develop for iPhone). You said you want to learn Cocoa, which is the framework that Mac development uses, so I assume you want to program for the Mac and not the iPhone. For the first two steps in the process (C and Objective-C), this makes no difference. For the third step, however, you will want to learn the Cocoa framework, whereas iPhone developers would be working with the Cocoa Touch framework.

    As I said, the standard path to take for someone looking to become an Mac or iPhone programmer is: Step 1.) the C language; Step 2.) the Objective-C language; Step 3.) the Cocoa framework if you want to program Mac applications or the Cocoa Touch framework if you want to program iPhone applications. So, you will want to start with learning the C language. You said you have some prior experience with C, but you are going to need to fully learn the language (or at least the basics until you reach a point where you can competently write programs in C) before you move on to the next step. You could always find a class that teaches C, which is a great way to learn. Other than that, I would recommend a good book on C. Any book will do (it doesn't have to be Mac-specific), but a book that teaches you C in the context of Mac can be helpful, so I would recommend the Apress book "Learn C on the Mac". Some other good ones, although not specific to Mac, are Sams "C Primer Plus" by Stephen Prata or Sams "Teach Yourself C in 24 Hours" or Sams "Teach Yourself C in 21 Days" or Sams "Absolute Beginner's Guide to C".

    Anyways, once you learn C and it's time to move on to Objective-C, you aren't going to have as many choices for a book, since Objective-C is Mac-specific by nature, and Mac programming books are scarce, but there's a book called "Programming in Objective-C 2.0" that I've heard good things about. I recommend, however, the Apress book "Learn Objective-C on the Mac" -- it is the second book in the Apress series (following the one I mentioned above, "Learn C on the Mac"), and this series is a great one for learning Mac programming, since it follows the three steps I mentioned earlier.

    Finally, after you learn C and Objective-C, you will then be ready to move on to Mac application programming with the Cocoa framework (or iPhone application programming with the Cocoa Touch framework if you change your mind and decide you want to do that, or you could always learn both). If you were programming for iPhone, the third and final book in the Apress series would be "Beginning iPhone Development", but since you want to program for Mac, the third and final book in the series for you will be "Learn Cocoa on the Mac". After you've read these three books ("Learn C on the Mac", "Learn Objective-C on the Mac", and "Learn Cocoa on the Mac") and learned the material that's presented in them, you will be a well versed Mac programmer. As you can tell, I have a preference for this series of Apress books for learning Mac/iPhone programming, but any book(s) that teaches the subject matter in a way that works for you will be fine. Find a good book store and spend some time looking over the first chapters of a few books on the subject so you can get an idea of what book will teach you the material in the way that suits you best, because in the end everyone learns differently, and every author teaches differently, so you have to try to spend some time matching up with the book that works best for you. If you have no other criteria to go on, though, I think the Apress series is perhaps the safest bet, especially since it is written for the modern Mac user.

    Anyways, I hope this helped you. Anything else you need to know will be covered in the Apress books I mentioned (that's one of the advantages of finding a Mac-specific book -- it will tell you how to work with Xcode and Interface Builder and whatnot), but if you have any other questions at all, please let us know and we'll do what we can to help. Best of luck on your journey toward Mac programming!
  • jakudo Level 1 Level 1 (0 points)
    Thank you very much Tron55555. I've read something similar, that I need to learn C at first step. I've learnt some basic stuff of C in one course 2 years ago, when I was studying abroad and now I would like to take C course in my home university. I've also downloaded this http://www.cocoalab.com/BecomeAnXcoder.pdf pdf file, which I would say is helpful too. 2 years ago I was able to write a simple program in C, however, I didn't use it during these 2 years, so I have to learn it again.

    Thank for the tips about the books. I will definitely buy some of them.

    Thanks a lot!
  • Tron55555 Level 2 Level 2 (180 points)
    Good -- glad I could be of help! Yeah, like I said, the Apress book "Learn C on the Mac" is great, especially since it's written for Mac users, but there are other good ones out there too. Sams publishes a bunch of really good C books, and even though they aren't Mac-oriented like the Apress one, a few of them are thicker and more detailed -- this can be a good or a bad thing depending on your style of learning. Also, it's worth mentioning "The C Programming Language" by Kernigham & Ritchie. This is a much older book, but it is the original text on the C language (it's sort of like the C Bible, if you will). I don't think it's a great book to learn C from alone, but if you buy it in addition to one of the others and use it as a supplement, it is an absolutely wonderful book. I haven't finished it myself, but I've been very impressed with it so far. Also, if you go for this book, make sure you get the newer edition that covers ANSI C.

    Finally, Apple doesn't have any documentation for the C language on the ADC (Apple Developer Connection) site, but once you get to Objective-C and Cocoa, you will find that the ADC site's documentation can be very helpful. I don't recommend using it as your primary source for learning Objective-C or Cocoa, but it can be a great supplement to a book or a course. Simply go to the ADC website and sign up for the Mac Dev Center (or the iPhone one if you want to develop for iPhone) -- it's free and easy to do, and you will then have access to all their documentation. Like I said, most of it won't be of use to you while you are still learning C, but it will definitely come in handy later. K T's tips thread has a great collection of documentation, so check his link out, but here's a quick list of the documentation I've found that's relative to learning to develop on the Mac:

    These three are for after you learn C when you get to Objective-C:

    [The Objective-C 2.0 Programming Language|https://developer.apple.com/mac/library/documentation/Cocoa/Conceptual /ObjectiveC/Introduction/introObjectiveC.html]

    [Object-Oriented Programming with Objective-C|https://developer.apple.com/mac/library/documentation/Cocoa/Concept ual/OOP_ObjC/Introduction/Introduction.html]

    [Learning Objective-C: A Primer|https://developer.apple.com/mac/library/referencelibrary/GettingStarted/ LearningObjective-C_APrimer/index.html]

    These two are for after you learn Objective-C when you get to Cocoa:

    [Cocoa Fundamentals Guide|https://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Co coaFundamentals/Introduction/Introduction.html]

    [Cocoa Application Tutorial|https://developer.apple.com/mac/library/documentation/Cocoa/Conceptual /ObjCTutorial/01Introduction/01Introduction.html]

    Finally, the next two links are introductory guides for the two application that you will be using to develop with on the Mac. The first, Xcode, is where you will write all your code, including when you're still learning and programming C, so I would recommend taking a run through the "A Tour of Xcode" documentation below -- it should help you get familiar with Xcode a little. The second, Interface Builder, is where you design the GUI's (graphical user interfaces) for your application, which isn't something you'll be doing until you get to Cocoa, so don't worry about it for now. Anyways, here they are:

    [A Tour of Xcode|https://developer.apple.com/mac/library/documentation/DeveloperTools/Conc eptual/ATour_of_Xcode/000-Introduction/qtintro.html]

    [Interface Builder User Guide|https://developer.apple.com/mac/library/documentation/DeveloperTools/Conc eptual/IB_UserGuide/Introduction/Introduction.html]

    Finally, these are some links to other "beginner" and "getting started" threads that people have posted at the forums here. You might find some of the information in them useful. Here they are:

    [iPhone and C|http://discussions.apple.com/message.jspa?messageID=10385229#10385229]

    [Newbie posting request (xcode and ?)|http://discussions.apple.com/message.jspa?messageID=10296904#10296904]

    [Becoming a Developer|http://discussions.apple.com/message.jspa?messageID=10282766#10282766 ]

    [Beginner programming OSX|http://discussions.apple.com/message.jspa?messageID=10178880#10178880]

    [Where to start?|http://discussions.apple.com/message.jspa?messageID=10168754#10168754]

    [New to Xcode|http://discussions.apple.com/message.jspa?messageID=10145003#10145003]

    Anyways, hope some of this was helpful, and best of luck to you!