Road to learn Cocoa

Discussion in 'Mac Programming' started by Ekram, Sep 11, 2009.

  1. Ekram macrumors newbie

    Sep 10, 2009
    Hi everyone
    i am completely new to mac world
    and i want to learn Coca, so what i should study before learning Coca
    i mean which programming language that would make learning Coca easier

    thanks in advance
  2. PatrickCocoa macrumors 6502a

    Dec 2, 2008
    Here's the Deal

    If you're new to the Mac world, you have a couple of areas that you need to get up to speed on. Cocoa is just one of these areas. Make sure that as you're learning Cocoa you don't let issues from these other areas trip you up.

    Here are the areas you'll need to transition:
    1. Mac vs. PC.
    You'll need to get comfortable with Finder, rather than Windows Explorer (if you're coming from the Windows world). You'll probably have some favorite text editors and paint programs. You'll need to get comfortable with their Macintosh replacements.

    2. Development Environment.
    You're probably familiar with a development environment (Visual Studio or one of the Java ones). Xcode + Interface Builder is completely different. You can spend the next six months swearing at Xcode because it's not Eclipse, or you can surrender to the difference and learn what Xcode is all about.

    3. Objective-C
    Hey, this isn't C++! What are all of these square brackets? That's not the way it should be done! Again, you can spend the rest of your life complaining that Objective C is not C++ (or Java or whatever), or you can embrace the change and live with it.

    4. Cocoa
    Finally! Now that you're up to speed on the OS environment, the development environment, and the programming language, you can start communicating with OS X with the Cocoa APIs.

    Good luck and welcome!
  3. Ekram thread starter macrumors newbie

    Sep 10, 2009
    thanks guys
    the problem for me that i will not get a mac until january so i decided to learn c and objective in this period until i get my mac
    anyway i got the book "the c programming language by K&R" from a friend
    but i don't know which IDE i should work on considering that i am still working on a PC
    again thanks in advance
  4. Ekram thread starter macrumors newbie

    Sep 10, 2009
    can i get quick answer please guys
    is it net beans or eclipse or is there something better
    can i write c code on visual c++ 2008 express, and is it the best option

    what i need is an IDE that goes well with the book -----] "the c programming language by K&R"
    it doesn't matter commercial or free
    please guys i am waiting for your reply
  5. zippyfly macrumors regular

    Mar 22, 2008
    You can learn to program using the non-GUI command line, with Foundation (not Core Foundation) and Objective-C.

    You can install Darwin to run on your PC (while you wait for a Mac).

    Darwin is the Unix layer of Mac OS X (without the fancy graphics interface).

    You'll still be able to write in Objective-C and do fundamental things.
  6. zippyfly macrumors regular

    Mar 22, 2008
    For the K&R book, you do NOT need any IDE.

    You just need a basic text editor (you can use emacs or vi but there are more user-friendly ones actually) and compile your Objective-C code with gcc. All of this is free and runs on your PC.

    Actually I believe you can just use Linux for all this (I'm not 100% sure; some of the gurus can advise you).
  7. Ekram thread starter macrumors newbie

    Sep 10, 2009
  8. zippyfly macrumors regular

    Mar 22, 2008
    You should learn the VERY BASICS of programming first, and not worry about a GUI.

    Loops, linked lists, pointers, binary search trees, recursion, etc. etc. etc.

    And this fulfills your criteria of cheap and easy, on a PC without a Mac.
  9. electroshock macrumors 6502a


    Sep 7, 2009
    To learn objective-C basics, look at Stephen Kochan's very highly recommended book on Objective C. Very easy to read and he does not assume you have any prior C or Objective-C experience, and builds up your knowledge with good examples.

    If you really want to practice obj-c with an IDE on Windows, the best is probably by using GNUstep:

    GNUstep developer documentation with information on how to use the tools and Objective-C itself:

    Keep in mind, GNUstep does not come with Apple's proprietary Objective-C libraries nor supports the NS classes. So you can still do Objective-C programming, but it will be different than the experience on MacOS X. Still worth it because that will help you think in the obj-c way.
  10. Ekram thread starter macrumors newbie

    Sep 10, 2009
    it's ok

    but i need a straight answer what i should use while i read the book
  11. zippyfly macrumors regular

    Mar 22, 2008
    1) You are assuming a GUI is easier to use. In this case, I don't think so. Others might disagree. I think you have too many things to focus on already, so you should just concentrate on TEXT ONLY because what you need to do is understand the syntax of C and Objective-C.

    2) You should learn the SYNTAX of C. Since you have no Macintosh, you cannot use the Foundation or Cocoa classes. So just concentrate on learning C on your PC. Install LINUX and program C with that. Just use "printf" to output your text to the screen.

    3) When you do get the Mac, get the 2nd edition of the Objective-C learning book by Stephen Kochan. It's not perfect and he leaves out quite a lot of stuff but it is probably the best start. And you will be using Xcode when you are at this stage 3.

    Prior to stage 3, I think my #1 and #2 suggestions above are sufficient for you.

    It has been said that you can skip C and just go straight to Objective-C (in fact that is S. Kochan's philosophy) but I think a good foundation in C really helps. IMHO.
  12. lloyddean macrumors 6502a

    May 10, 2009
    Des Moines, WA
    You keep pressing for an answer to something only you can really answer. And in order for you to come to an answer you'll need to try the various tools that have been suggested to you.

    The book in question makes no reference to, and does not assumes the use of, an IDE of any kind.

    Any IDE you decide to use will take you on a slight detour in you stated goal of learning programming as you'll be distracted by the need to also learn the IDE at the same time.

    So will Visual Studio 2008 Express allow you to do console based development as presented in the K & R book "The C Programming Language". The answer is yes, but, you'll also need to learn to use it to create projects, add and edit source files, compile, run and debug the C language lessons being learned.

    So, quick you need an answer!

    What will it be?

    Let us know what you decide!
  13. Ekram thread starter macrumors newbie

    Sep 10, 2009
    i choosed code blocks

    well i want to tell you my schedule in programming
    first i want to be a mac developer and i will not have a mac until january
    so here us what i want to do before get a mac:
    1- learn C
    2-learn objective C

    i also have a question, will any c++ compiler compile C code
  14. zippyfly macrumors regular

    Mar 22, 2008
    You should ask, which compiler will compile C and Objective-C.

    the free compiler called "gcc" will do all that, plus many other languages.

    Again, as I suggested, just use Linux on your PC and learn C. You can also learn Objective-C but the libraries are different (in my opinion, you will be better off just learning fundamental C syntax and underlying concepts, and then jump right into Objective-C and the Foundation classes with Xcode on the Mac).

    When you get your Mac, go right into Xcode and Objective-C.
  15. sanPietro98 macrumors 6502a


    May 30, 2008
    But if you must use a Graphical IDE, I would use XCode once you get your Mac in January. I have been working in Java for the past 10 years and fully expected to just use Eclipse when I started writing Objective-C / Cocoa code. That didn't work out too well. Apple (or at least NeXt) did a great job in developing XCode and Interface Builder. Using these tools really sped up my adoption of Cocoa.

    But I agree with other posters here, you should master the basic language first before jumping right into graphical UI development with Cocoa.

Share This Page