OS X Programming (C, C++ and Objective C)

Posted:
in macOS edited January 2014
I'm very excited about programming for OSX (especially using coreAudio coreMidi and audioUnits) but I'm confused as to where to begin.



Most of my programming expereince has been in lingo and actionScript. I picked up a book on Cocca and it suggests learning C++ first, so I've started and it's coming very easily, but I read in Apple's objective C documentation that I should learn C, but then in the C++ book it says not to learn C. So I guess I'm just looking for some suggestions here.



Where do I begin?



Thanks for any and all info!!



joshua

Comments

  • Reply 1 of 4
    skipjackskipjack Posts: 263member
    [quote]Originally posted by zvonx:

    <strong>

    Most of my programming expereince has been in lingo and actionScript. I picked up a book on Cocca and it suggests learning C++ first, so I've started and it's coming very easily, but I read in Apple's objective C documentation that I should learn C, but then in the C++ book it says not to learn C. So I guess I'm just looking for some suggestions here.



    Where do I begin?



    joshua</strong><hr></blockquote>



    This is only a student's opinion. You'll get more knowledgable answers in rebuttal:



    If you've started with C++ and are comfortable with it, keep on with that. I'll assume you're picking up the basic control structures. Then, when you get to objects, just get a basic idea of what is going on, and then pick up with Objective-C.



    If you decide to look at C instead, cover the basics until you get to dynamic memory allocation, then look at C++ objects or go directly to Objective-C.



    As for a book, besides the on-line documentation and the O'Reilly site (www.macdevcenter.com), in your case I'd go with "Building Cocoa Applications" (an O'Reilly book), I'd skip "Learning Cocoa" (an earlier O'Reilly book), and I'd use "Cocoa Programming for MacOS X" as a followup. If I remember correctly, "Building Cocoa Applications" will help you to learn Objective-C and the Developer's Tools more than the other two. However, don't be surprised to see that Project Builder and Interface Builder are slightly different than described in those books.



    From an Objective-C point of view, the language builds on C.



    From a C++ point of view, even though the C syntax works in C++, C++ uses different methods to accomplish the same task, so the C programmer would have to learn some new habits.



    In either case, Objective-C and Cocoa use some different methods from C and C++ (I'm thinking about data input and output), so there is some new stuff whether you come from C or from C++.
  • Reply 2 of 4
    [quote]Originally posted by zvonx:

    <strong>I picked up a book on Cocca and it suggests learning C++ first</strong><hr></blockquote>



    I am shocked that a Cocoa book would recommend learning C++ this is so unecessary it is bordering on perverse. Which book is it?



    My advice:

    If you've got any programming experience at all (which you do) then diving right into Obj-C and Cocoa will be no problem. Get one or two good books and work through the examples in them and freely availble online. As you learn Cocoa you'll learn enough C and Obj-C to get by and you'll get immediate visual feedback which will inspire you to greater things. You also want to find somewhere to go for help if (when) you hit a brick wall. Apple's cocoa mailing list seems ok with the occasional 'stupid' question.



    Book recommendations: not O'reilly's Learning Cocoa 1st edition (though their soon to be released--and slightly renamed--2nd edition, Learning Cocoa with Obj-C seems like it could be up to their usual standards). The Hillegras book gets good reviews and the Scott Anguish one 'should' be good).
  • Reply 3 of 4
    amorphamorph Posts: 7,112member
    You might be interested also in using <a href="http://www.apple.com/applescript/macosx/ascript_studio/"; target="_blank">AppleScript Studio</a>, which is capable of building full-blown Cocoa apps. You can use <a href="http://www.apple.com/applescript"; target="_blank">AppleScript</a> exclusively or write hybrid applications - a great way to get started quickly and add more sophisticated behavior as you learn Objective-C.



    Do not learn C++ before learning Objective-C. If anything, do it the other way 'round. I'll second Aaron Hillegass' book, and Scott Anguish's <a href="http://www.stepwise.com"; target="_blank">StepWise</a> site is invaluable.
  • Reply 4 of 4
    airslufairsluf Posts: 1,861member
Sign In or Register to comment.