Learning objective C 2.0 (Advice Needed)

Discussion in 'Mac Programming' started by shahrezsyed, Oct 1, 2011.

  1. shahrezsyed macrumors regular

    Joined:
    Oct 1, 2011
    Location:
    Stony Brook, New York
    #1
    Hi
    I recently got REALLY interested in objective C 2.0. I asked a few people regarding learning it. I got suggestions to study the following:
    1- Firstly, a book called learn c on the mac. (they said it's not necessary but helpful)
    2- then after I'm done with c, I should study obj c 2.0 from two books:
    a- Programming in Obj C 2.0 by Stephen Kochan and learn obj. C on a mac.

    What do you guys say based on your experience? And btw. I donot have Any previous programming experience.
     
  2. rien333 macrumors regular

    Joined:
    Jun 29, 2010
    Location:
    The Netherlands
    #2
    I think you're going to have a hard time understanding the second and third book if you didn't read the first one.
     
  3. shahrezsyed thread starter macrumors regular

    Joined:
    Oct 1, 2011
    Location:
    Stony Brook, New York
  4. rien333 macrumors regular

    Joined:
    Jun 29, 2010
    Location:
    The Netherlands
    #4
    Quite ok. I started with a relative simple language called Python and became familiar with some of the concepts of programming with a book called something like "How to think like computer scientist, Python edition", which made it easier to start with more advanced languages like C. You could try this as well, but it is possible to start with learning C (instead of a simpler language like Python).
     
  5. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #5
    I'm increasingly of the opinion that new programmers should start with an object-oriented language first. So I suggest learning something like Python or Ruby (or Java, if you must) first, then C (but not too much), then Objective-C.

    What I mean my not too much C is don't get bogged down into the C mindset, learn just the C that's the foundation of practical Objective-C. Kochan's Programming in Objective C will teach you enough C. BTW there's now a 3rd edition of Kochan that been updated for XCode 4.

    There is an advantage to learning Ruby over Python at first. Ruby is based around the same object-orientation style of Smalltalk as is Objective-C. Although Ruby is closer to Smalltalk than Objective-C is. The disadvantage is that there's many more Internet resources for Python in English than there is for Ruby.
     
  6. balamw, Oct 2, 2011
    Last edited: Oct 2, 2011

    balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #6
    Everyone learns things differently, but I am with Jiminaus.

    Kochan teaches you enough C to be functional and you can always fill that in later. Learning a low-level procedural language like C can lead to habits that are hard to break when working in OOP environments.

    Just like "there's an app for that" more often than not "there's method for that" which, if you are used to doing things in C, you might end up reimplementing for no reason. Example: http://forums.macrumors.com/showthread.php?t=1212054

    I suggest starting with Kochan first and then back filling your C knowledge about half way through the book. Kochan is worth working through in detail, but if you find it doesn't resonate with you initially resort to your original plan.

    B
     
  7. shahrezsyed thread starter macrumors regular

    Joined:
    Oct 1, 2011
    Location:
    Stony Brook, New York
    #7
    Alright.
    I am in no hurry so I think I'll go for python first. Then I'll do obj c. Alright.
    Thanks a lot for the great advice btw.

    ----------

    Could anyone suggest a good book to learn python?
     
  8. firestarter macrumors 603

    firestarter

    Joined:
    Dec 31, 2002
    Location:
    Green and pleasant land
    #8
    The O'Reilly "head first" books are awesome.
     
  9. shahrezsyed thread starter macrumors regular

    Joined:
    Oct 1, 2011
    Location:
    Stony Brook, New York
  10. r0k macrumors 68040

    r0k

    Joined:
    Mar 3, 2008
    Location:
    Detroit
    #10
    I took advantage of Borders' going out of business sale to pay 60% off on the rather expensive ($50 each!) books: Arron Hillegas' "Cocoa Programming for Mac OS X" and Wentk's "Cocoa Developer Reference".

    I have C, java and javascript programming experience. I would recommend javascript rather than python as you can test your code in any browser and even on an iOS device. Of course you need to get it onto a web server but there are dozens of free web hosts available including apache on your Mac. Javascript references are available on the web for free. No books required.

    Careful trying to use web resources to learn Xcode. The same is true for most books. Be sure to download xcode and take a look around the user interface. This way you can look at the illustrations on the web site or the book you are thinking of using and tell right away if they are instructions for an older version of xcode. The books I have are for older versions of Xcode but they still work for me. I did't mind so much because I got a sweet discount. If you are paying full price, make sure the book you buy matches up closely if not exactly with the version of xcode you plan to use. It's a good idea to check authors' and publishers' web sites to see if they announce new titles. Also search the titles on Amazon and they offer links to reserve a new edition if it is coming out soon. Lastly be careful about sample projects posted on the web. Many of them won't build with the latest xcode and may offer more confusion than help.
     
  11. Jaste macrumors newbie

    Joined:
    Feb 13, 2010
    Location:
    Adelaide, South Australia
    #11
    Noob question here:

    Can anyone tell me what the difference is between Stephen G. Kochan's Programming in Objective C and Programming in Objective C 2.0? Both books seem to be getting updated. The blurbs on both books read exactly the same except for the 2.0 in the title. Are they a two part series (ie the 2.0 is the second book) or are there two main versions of Objective C, different enough to warrant release of similar books?

    Thanks,

    Greg
     
  12. GorillaPaws macrumors 6502a

    GorillaPaws

    Joined:
    Oct 26, 2003
    Location:
    Richmond, VA
    #12
    They're different editions of the same book. You want the newest edition which is the 3rd.
     
  13. MorphingDragon macrumors 603

    MorphingDragon

    Joined:
    Mar 27, 2009
    Location:
    The World Inbetween
    #13
  14. larswik macrumors 68000

    Joined:
    Sep 8, 2006
    #14
    I am taking a Java course a City College. They had no prerequisites for the computer classes since a programmer may already know these things and wants to learn Java. That was so they don't have to start with programming fundamentals. First day of class the teacher asked us how many people in here have taken C, Pascal or other programming classes. 1/3 of the people raised their hands. Then he asked how many of you are learning programming for the first time. 2/3's of the class raised their hands.

    The teacher then said those who have not taken a programming class should consider another class to learn programming first. Only a few people of the 35 or so people did that and the rest stayed. After the 5th week we went from 35 people to around 18, about 1/2 the original size.

    The instructor said this happens every semester.
     
  15. urbanlung macrumors regular

    urbanlung

    Joined:
    Jan 24, 2004
    Location:
    location location, location!
    #15
    I'm new to programming too

    Hi, I'm new to he programming lark as well. I've been using Kochan's 'Programming in Objective-C' from 2004. So far it seems to make sense. My 11 yr son used 'Hello World' by Warren Sandle an introduction to python to learn about programming and has been slowly working through 'iPhone app dev in 24 Hours' also from Sams Pub.

    good Luck
     
  16. Mac_Max, Oct 13, 2011
    Last edited: Oct 13, 2011

    Mac_Max macrumors 6502

    Joined:
    Mar 8, 2004
    #16
    I have a background in C++ and C# and have been teaching myself Objective C via Apple's free book The Objective C Programing Language

    http://developer.apple.com/library/mac/documentation/cocoa/conceptual/objectivec/objc.pdf

    It's a good read once you have a background in C or C like language.

    Echoing sentiments expressed above (and taken verbatim from the first C# book I read): Know your toolkit. That makes using any language much nicer, more so than any IDE or any single language feature. I'm not sure what the equivalent book is for Objective C and the Foundation/Cocoa libraries, but this book on the STL really helps me when I can't figure something out and my google fu is weak. I have similar books for C#/WPF/Silverlight as well for when I'm programing for the Dark Side ;).
     
  17. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #17
  18. NeuralControl macrumors 6502a

    Joined:
    Dec 3, 2009
    #18
    Thanks for posting this. Nice resource that I will be checking out.
     
  19. perrien macrumors newbie

    Joined:
    Apr 26, 2008
    #19
    What you're suggesting is similar to what I did. I actually just started with some free online tutorials of C and my first book was the Obj-C one you mentioned (which is excellent by the way).

    I'm now much more comfortable with Obj-C than with plain C and kinda regret not spending a bit more time on the basics. So take that as a recommendation to start with C, then move on.
     
  20. skochan macrumors regular

    Joined:
    Apr 1, 2006
    Location:
    California
    #20
    Because of ARC I had to write a 4th edition, which will be out towards the end of November. I regret the short time between the 3rd and 4th editions, but the 3rd came out right after the announcement of ARC at WWDC 2011. And ARC makes it so much easier to learn Objective-C, that I had to cover it.

    Some other minor changes (such as being able to declare instance variables in the implementation section) are also covered in the 4th edition (in fact, all instance variables are now declared there in the examples).

    Those using an earlier edition can get some tips on making the transition to ARC from my forum at classroomM.com/objective-C.
     
  21. North Bronson macrumors 6502

    Joined:
    Oct 31, 2007
    Location:
    San José
    #21
    Do you feel if a developer started learning Objective-C by using ARC, and then needed to transfer to a Core Foundation framework (like Core Graphics) that required them to learn the memory-management principles, it would take them more or less effort than it would have taken to learn Objective-C with manual memory management in the first place (assuming that the transition to Core Foundation would then be trivial)?
     
  22. skochan macrumors regular

    Joined:
    Apr 1, 2006
    Location:
    California
    #22
    That's an excellent question! Yes, I do think it's better to learn Objective-C without worrying about manual memory management. It's a hard concept for new programmers to absorb. Once a programmer starts using Core Foundation (and who knows when they'll need to do that), I think it will be easier to pick up CFRetain/CFRelease at that point (I kind of think of it more like learning to use malloc/free, which when learning C can be tackled later, whereas you need to learn retain/release/autorelease early-on if you're not using ARC).
     
  23. DavidBaraff macrumors newbie

    Joined:
    Nov 3, 2011
    #23
    A funny thing happened on the way to the bookstore...

    I have been meaning to take up Cocoa/Mac/IOS programming several times; last November, I got within spitting distance and once again got diverted.

    So here I was, heading off to my local book store this weekend to FINALLY buy SKochan's (3rd) edition Objective-C book. Fortunately, for me, the one copy in the store was a bit tattered, so I decided to buy it on Amazon. And what do I see? There's a *4th* addition coming out. And it's got a section on this stuff called "ARC." A few minutes of googling later, and I'm trying to decide if this is some elaborate April Fool's joke.

    Objective-C without having to retain/release all over the place? Without autoreleasing? That's the major thing that's made me pause, so many times, before picking up this language. (I've been programming in C++ since 1985, so I'm a bit biased. And these days I'm having an elicit love affair with Python on the side. Don't tell me C++ code...)

    Well, after two solid days of watching WWDC lectures, and reading all the notes, and seeing how LLVM is managing this it, I'm pretty impressed. This sounds fantastic!

    But I'm left with a few questions:

    1. Is the 4th edition of the book going to effectively teach the proper way to do things, in the sense that if ARC had always been there, and we never did retain/release, how different would the teaching of the language/frameworks be? Is the 4th edition have these topics as add-ons (understandable, if so -- it's not a criticism), or will it really teach me now how this language should be used now that ARC is there. (I feel that people who never ever had to use the frameworks pre-ARC may do things quite a bit differently than people who know retain/release liek the back of their hand, but are only now starting to use ARC...)

    For example, blocks/properties/statements about atomicity: it seems like it's become a bit jumbled, with multiple ways to do things. I hope the ARC syntax is going to unify all this --- given that I'm starting from a blank slate, I want to know the *right* way to do all this going forward, without baggage from the past weighing me down...

    2. I'm also trying to understand how STL might figure into this. I like the idea of programming in Objective-C++, and using C++ classes where appropriate. What if I use ARC on unit A, and not on unit B, so that the compiler can't see inside B, and suppose I pass a vector<__strong MyClass*> into B?

    If B kept my vector, but returned me several copies of that same vector over time, how would the compiler guarantee that I didn't overrelease the objects? I know there's a convention on naming of functions that might give ARC a clue but does it apply to C++ syntax as well? (Waving my hands here -- feels like there's something here to worry about...)

    3. Do I really have to wait until January for the 4th edition? :)
     
  24. skochan macrumors regular

    Joined:
    Apr 1, 2006
    Location:
    California
    #24
    1. Yes. that is the approach of the 4th edition. It's as if ARC always existed, at least until the chapter on Memory Management (Chapter 17). There's no reason to discuss the issue until much further in the book, unlike earlier editions, where I spent a lot of effort reinforcing the idea of releasing objects when you were done using them. When I teach ARC to seasoned and new objective-c programmers, I tell the seasoned ones that it's going to be harder for them to use it than the newer programmers. The seasoned ones instinctively don't trust it at first and don't believe it really works.

    2. I don't use Obj-C++ myself, but this is from Apple's ARC Programming Guide:

    3. I finished the 4th edition in August. The publisher is a little slow getting it out. It should be available sometime next month, with the ePub and PDF versions out even sooner.

    Cheers,

    Steve
     
  25. frocco macrumors 6502

    frocco

    Joined:
    Jan 27, 2009
    #25
    Any books that teach by having you build a database application?

    I learn best by hands on.

    Thanks
     

Share This Page