Cocoa Programming

Posted:
in macOS edited January 2014
Hi all, I recently picked up O'Reilly's book on learning Cocoa. My programming experience in C is minimal. However, I can pick up language I try. I currently do Perl, Bash, and have done various other sorts of coding.



My questions are:

How easy is it to learn Obj-C/Cocoa?

Are there some decent, non-dry boring, resources for learning Obj-C/Cocoa?

How long does it take to pick up if you have a decent background in programming?



Any help is appreciated,

Thanks

Comments

  • Reply 1 of 11
    aslanaslan Posts: 97member
    Bwah ha ha ha!



    If there is one thing that mars just slightly the developer experience in OS X, it HAS to be the fact that to use Cocoa (which IMHO is friggin awesome), you must be able to code in ObjC or ObjC++ (w/ the latest full dev release). (well....OR Java, but my experience shows Java/Cocoa to be a little clunky (at least for now... besides most of the framework was developed using ObjC and so is more true to form.)



    First of all, ObjC is a much better "implementation" of an object-oriented language than C++. This is mad simplification of a deep topic, but ObjC is essentially C with object oriented extensions a la Smalltalk (sortof). ObjC supports actual message passing as opposed to "simulated" message passing used by C++ and Java in the form of function/method (respectively) calls. Also, amongst other things, ObjC is a dynamically typed and bound language, pushing type-decision as much as possible toward the run-time of the application. This allows for run-time control over certain factors that under other statically typed languages would be unavailable at the time of compilation.



    Unfortunately, ObjC has a pretty steep learning curve if you are unfamiliar with the concepts of object-oriented design (and i am not just talking about C++'s or Java's design of OOP, but the actual concepts of message passing, data-abstraction, etc.)



    Thankfully, the ObjC extension, if extremely pithy, is rather small in size, allowing you to get a good grasp of it after extensive use (as compared to C++ which is a mess of smashed together features which are supported in varied ways by different compilers.)



    There are also better books than O'reilly's Cocoa programming. God bless those guys, but the book is mostly an API reference gathered hastily by Apple programmers and documented with the care they are oh-so-famous for.



    Other nice books include OS X Developer's Guide, which amongst other things provides some good tutorials w.r.t. the programming environment provided both by Darwin & JDK and by Project Builder/Interface Builder. It also examines some ObjC syntax and usage.



    The book "Cocoa Programming for OS X" produced by the Big Nerd Ranch is a very nice book that actually goes through the process of development with you and introduces both Java and ObjC use of Cocoa APIs. This is a great beginning book.



    Don't forget online resources such as stepwise.com and Apple's developer center's online documentation. There are some good PDFs about ObjC and Cocoa there as well. Check on stepwise for the Vermont Recipies by Bill Cheeseman. They are GREAT beginner tutorials for Cocoa/OS X development.



    PLEASE PLEASE PLEASE don't give up on ObjC and Cocoa. Carbon blows. Posterity will thank you for developing Cocoa instead of Carbon (trust me on this one...really!)



    besides, learning a new language is good for you and makes you a better programmer.



    Now my only pointless comment:

    I wish from the bottom of my heart that I could call Cocoa APIs from Scheme/LISP! Boy that would be sooooo phatty!



    Hope this helped...sorry so long!



    [ 05-07-2002: Message edited by: Aslan ]</p>
  • Reply 2 of 11
    rick1138rick1138 Posts: 938member
    Yeah,Objective C does have a steep learning curve,but it is well worth it,once you've mastered Objective C you'll basically have mastered all the concepts required for any imperative language.It's advanced conceptually,but it is possible to write very powerful programs with very little code once you are used to it.

    Another good book is Scott Anguish's book Cocoa programming,which is coming out this month.Also,if you are doing any serious graphics programming you will have to learn OpenGL as well,which is ,unfortunately,a very clunky API.It will only take a few weeks to pick up if you already have a decent background in programming,and a few months to really feel comfortable.
  • Reply 3 of 11
    hekalhekal Posts: 117member
    Thanks for the input. Do not fear, I am not giving up on Obj-C. There are several utilties I want and it looks as if I will need to code them myself.
  • Reply 4 of 11
    hekalhekal Posts: 117member
    I will go through all of this book, and then move on to more. The book does seem like it's geared to the more experienced programmer. I can pick this up, no problem. I just need some good resources.



    Carbon sux javascript: x()

    Eek!
  • Reply 5 of 11
    overtoastyovertoasty Posts: 439member
    [quote]Originally posted by hekal:

    <strong>Thanks for the input. Do not fear, I am not giving up on Obj-C. There are several utilties I want and it looks as if I will need to code them myself.</strong><hr></blockquote>



    I'd pretty much second what's already been said here, you'll want to definitely pick up Aaron Hillegass' "Cocoa Programming for Mac OSX" from Big Nerd Ranch ... I've got both it and the O'Reilly book ... much as I usually love O'Reilly books, I'm afraid Aaron's book kicks O'Reilly's ink pen animal butt on this one ... he's way more down to earth, realistic and in tune with the actual process of learning Obj-C & Cocoa itself, not just in documenting the facts of the language and providing paint by number examples, which is being a little harsh on the other book, but not far off the mark ...



    FWIW, I've done a bit of Obj-C coding previously, I really liked it, but unfortunately I couldn't stick around the guru long enough to get beyond the novice level( I was there for the joy, not the cash, this was before any of the new books came out), so I had to take a gig - albeit a nice gig - coding in Java.



    They're very close you know! Java & Obj-C, so if you learn Obj-C, getting comfy with Java will take at most maybe a couple of weeks, if not a couple days ... and, once you get into interface builder with Obj-C, you'll really start to wonder WTF Sun was thinking when they came up with swing ... anyway, Java and Obj-C are so close, that if Java wasn't so anal about hard typing ... they'd be, well ... very very close ... anyway ...



    Also, if you're already a C head, one of the things you'll love about Obj-C is the ability to just downshift right into C if you ever want to; which is something Java could never do.



    The big drag about Obj-C however, is that it's not really been much updated lately ... but that's probably because it was so far ahead of it's time, kinda like OSX itself, that people are still freaking out as they grok what's been around for a while, yet they've never encountered, in the case of Obj-C, this amounts to stuff like dynamic binding and categories ... there was a new language that some guy was trying to develop a few years back called "TOM" which was supposed to be the next big thing, taking OOP to it's outer most limits ... but last I heard

    it was too ahead of it's time and so it's kinda floundered ...



    Hmmmm ... has anybody out there, come from C++ and gotten into Cocoa?



    I'd be interested in hearing what that would be like!
  • Reply 6 of 11
    hekalhekal Posts: 117member
    Thanks for the advice guys. After I finish O'Reilly I will pick up Cocoa Programming for Mac OSX and give it a whirl. I am determined to learn Cocoa and ObjC.
  • Reply 7 of 11
    rick1138rick1138 Posts: 938member
    Aaron's book is a lot better.It's easier to follow and more advanced,I highly recommend it.
  • Reply 8 of 11
    I am using Aron Hilgass's book. I was told to stay away from O'Reily (they shot themselves in the foot on this one). Its good. I have gone through Obj-C which has some conceptual bits to get my head wrapped around but its good and forward thinking.



    One of the things I am interested in is doing some Cocoa programming calling OpenGL and QuickTime but the QT API seems lame at this point. (NSMovie and NSMovieView).



    Can Anyone reccommend a good beginniner OpenGL book for Cocoa programmers?
  • Reply 9 of 11
    rogue27rogue27 Posts: 607member
    I don't think a Cocoa/OpenGL book exists right now...



    I'd like one of I could find it though.
  • Reply 10 of 11
    hekalhekal Posts: 117member
    Oh well, I boughtg the O'Reilly. I will complete the book and move on.
  • Reply 11 of 11
    rick1138rick1138 Posts: 938member
    I have a small demo Cocoa/Open GL app of a rotating cube if anyone wants it,with source code of course.
Sign In or Register to comment.