Cocoa Progamming for Beginners.... is there such a thing?

Discussion in 'Mac Apps and Mac App Store' started by walkingmac, Sep 22, 2003.

  1. walkingmac macrumors 6502

    walkingmac

    Joined:
    Mar 30, 2003
    Location:
    Greater Cincinnati
    #1
    I am a graphic and media artist by trade, but I have noticed some of the clients I work with need apps that aren't available in the market. I have great concepts and the desire to learn the language (I have already ordered 3 introductory books and of course the Developer Tools). the wall I am hitting now though is that all these books have a basic flaw, they assume that the reader has a background in programming language.

    I cry for help is, I am looking for a good tutorial to help me assimulate what I need. A DVD self-paced learning guide. Something visual would be the best ofcourse. I am finding even the book to be a little cumbersome. As I don't know the language or whats going on under the hood (granted, sometimes I don't need to, but like with html, with the right tools, I don't need to know it all... just a basic understanding to make it all work).

    I am fine with this being more complex and requiring more attention to detail. I just am trying to understand the details. Please, with the vast resourses of this online network, is there any comprehensive resources out there that can help the entry level programer with no background develop applications?
     
  2. benixau macrumors 65816

    benixau

    Joined:
    Oct 9, 2002
    Location:
    Sydney, Australia
    #2
  3. FattyMembrane macrumors 6502a

    FattyMembrane

    Joined:
    Apr 14, 2002
    Location:
    bat country
    #3
    programming takes a long time and in my opinion is very difficult. cocoa programming is very powerful once you know what you're doing, but there's really no pathway from knowing nothing to using cocoa. first you have to learn c. there are lots of free c tutorials online, and you need to know all of it to program any useful cocoa application anyway. don't worry too much about the interface, formatting, and output, the procedure is all that really matters since cocoa handles the interface for you.

    then you need an introduction into object oriented programming, which is a very simple concept that can probably be summed up in one sentence, but any book you buy on the subject will turn it into some nebulous, esoteric, fiasco (i'm working on an intro to c and object oriented programming that i hope to post soon).

    once you know c and how object oriented programming works, a good book on cocoa will make much more sense. apple's developer docs are confusing even if you know what they're talking about. even the beginner tutorials for objective-c just make you do stuff without explaining it, leaving you more frustrated than before.

    1. learn c. it shouldn't be too hard if you find a good tutorial (steer clear of anything by dave mark)
    2. regardless of what any developer documentation tells you, an object is just a collection of functions and variables that only modify other variables and functions in that object; that's it, it's not as complicated as they make it out to be.
    3. work through a cocoa book at a pace with which you feel comfortable, keeping in mind that the people who wrote it don't really know what they're doing, so you might have to check some of the cocoa websites to figure it out :)

    keep in mind that you will be frustrated most of the time you're learning how to program; it's unavoidable, but nobody ever admits to it
     
  4. walkingmac thread starter macrumors 6502

    walkingmac

    Joined:
    Mar 30, 2003
    Location:
    Greater Cincinnati
    #4
    Hey FattyMembrane, thanx for your reply. VERY HELPFUL. OK, so now I should look into a C programing book?

    My initial looking lead me to 'C++ How to Program (4th edition)' any thoughts?

    But really thanx for the input and your clear-cut honesty.
     
  5. FattyMembrane macrumors 6502a

    FattyMembrane

    Joined:
    Apr 14, 2002
    Location:
    bat country
    #5
    if you are planning on programming only in cocoa for mac osx, you should only learn c (c++ adds some confusing concepts that you don't need to know). cocoa uses objective-c and all of the cocoa books for beginners (even the apple docs) teach you objective-c (it's just a few simple add-ons to standard c and takes maybe an hour to learn).

    if you prefer having a book to learn c, check some of the reviews on amazon.com, they're usually pretty helpful and people often include comments about how clear and easy the explanation was. there are lots of great resources online for free; the book i used to learn c is available here.

    after i learned most of how c works (i'm still a total novice), i picked up "learning cocoa" by orielly in the bargain bin of my local bookstore. people have said that it's not that great, but it's pretty clear and straight forward (i've heard nothing but good reviews of aaron hillegass's "cocoa programming for mac os x"). i find an actual book (not just a web tutorial) to be very helpful when starting out with cocoa.

    if you are planning on writing programs for multiple platforms (mac/windows/unix), you will probably want to learn c++, since most toolkits on other systems use it. but even then, i'd recommend getting your feet wet with cocoa on osx because it does all the heavy lifting for you and allows you to see results very quickly and not get too frustrated.

    and remember to stick with it. i can't count the number of times i gave up because of frustration. most of the people writing programming docs have been coding for years and have forgotten what it's like to start from scratch.
     
  6. walkingmac thread starter macrumors 6502

    walkingmac

    Joined:
    Mar 30, 2003
    Location:
    Greater Cincinnati
    #6
    Hey thanx for even MORE input, this is great stuff. Thanx for clearing up the whole C and C++ thing. That being said, how difficult is it to portal an app made in os x to windoz? IS it that close in computer language or is there still a large rift between them?

    Thanx for the link for the online book study. That will definitely be a huge help, as well as the lead for future books to look at.

    Again thanx for the tutorial links, they are actually VISUAL and make sense.
     
  7. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #7
    Porting Cocoa apps is a serious pain in the arse (when it's even possible). There ARE completely nuetral ways of making apps (RealBASIC, Java, etc...), but Cocoa isn't one of them.
    C++ is very complicated (I started on it, which I regret). Sometimes I would spend weeks on a single stupid bug, then discover it was something utterly trivial (this is where having a teacher helps).
    If you have any basic Cocoa/C/Objective-C questions, feel free to IM me (CatfishMan42). I may not be able to help (especially with C stuff), but I'm moderately good at Cocoa and I'm sorta-kinda-unofficially teaching beginning Java.
     
  8. mmmdreg macrumors 65816

    mmmdreg

    Joined:
    Apr 14, 2002
    Location:
    Sydney, Australia
    #8
    Heh I'm a total n00b too. Well I know VB to an extent. I got Hillegass's Cocoa Programming for Mac OSX and worked through a bit of that but maybe it's my attention span cos I can do all the stuff by reading the book but it doesn't hang around in the head for too long :p So i got the "for dummies" book and when that comes, I'll see what comes of it.
     
  9. bousozoku Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #9
    I recently received an e-mail from MacTech magazine promoting that they had hired Dave Mark since he was such an expert. Unfortunately, his books don't seem to show any expertise. His book on C++ looked as though he was learning C++ chapter by chapter. :D

    Remember that good habits from the start help you in the long run. It make take more time to be methodical, but it will save you hours in tracking bugs.

    You probably already make storyboards. Planning like this can be done for programming as well. Decide what you want out of the work you're doing. Decide what you need and how you can process it to get the output.

    You can also break down the processes into human language for your convenience. If you don't know how you would do it by hand, you probably don't have a good handle on the problem.
     
  10. FattyMembrane macrumors 6502a

    FattyMembrane

    Joined:
    Apr 14, 2002
    Location:
    bat country
    #10
    it depends on the complexity of the app. any of the programs in a basic c book will run with a simple recompile on any computer because they don't require any high-level interface code - they just run in the command line. to keep programmers from having to re-invent the wheel, operating systems offer a framework for building common interface items so that you don't have to figure out how to do it in each program. a grossly oversimplified example would be drawing a window; on windows, you might call a function

    makeWin(500,300, "my window")

    which creates a window with the dimensions 500 pixels tall, 300 pixels wide, and a title of "my window". on a mac, the function might be

    drawWindow("my window", 300,500)

    so you can see how things can get hairy when you have to change this for every interface element, and everything that gets information from the os/computer.

    cocoa removes the need for most of this by using .nib files from interface builder, that way, you just make the interface as though you were laying out a page for print and tell it to perform an action(function) you've already coded when something happens.

    unfortunately, other systems don't use .nib files for interfaces, and they don't use objective-c objects to deal with the os (most of them use c++), so if you need to get the date from the internal clock, on the mac, you would use

    [NSCalendarDate date]

    but since the windows frameworks for using the os are in c++, it might be something like

    WinDate::Cal.Yr.Mo.Da i don't know c++ so forgive my awful attempt

    you can use c++ in cocoa (as of 10.2 i believe) with a mixture called objective-c++ or program using the carbon framework which is entirely based in c++. yet another option would be to code the core of your program in java, since cocoa allows you to use java to access it's components just like you can in objective-c and even use native cocoa interfaces.

    the bottom line is that porting is always going to be a challenge if you're moving between development frameworks. cocoa/objective-c applications are going to be very difficult to port to different platforms. carbon will be easier but you lose out on some of the features that truly set osx apart. java, of course, would probably be the easiest to port, but then again, it's java.

    if you're interested in porting to linux, things may actually be easier, since the GNUStep project is based on OpenStep(NeXTStep) and uses almost exactly the same frameworks and development environment as cocoa.

    whew. sorry if some of that is unclear let me know if i botched something or if it doesn't make sense.
     

Share This Page