"Programming in Objective-C 2.0" - Developer's Library - Stephen G. Kochan

Discussion in 'Mac Programming' started by Darkroom, Jun 22, 2008.

  1. Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #1
    The 2nd edition of "Programming in Objective-C (2.0)" is being released in November 2008. It's available now for pre-order.

    For someone who's currently learning Objective-C and Cocoa development, i would like to order the first edition from 2003, but i'm concerned that Objective C 2.0 will be vastly improved/different... is is worth waiting for this? how great is the difference between Objective-C and Objective-C 2.0?
     

    Attached Files:

  2. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #2
    You'll need to know Objective-C 1 if you are programming for the iPhone anyway as garbage collection is not available on it. So you'll still be doing your own memory management. Objective-C 1 is fine to use.

    There are some nice features to Objective-C 2 but you'll do just fine with the 2003 book.
     
  3. macrumors 68040

    neiltc13

    Joined:
    May 27, 2006
    #3
    I'm looking into this book too. Amazon.com has it down for a US release on January 2nd, with a UK version launching later in that month. The cover makes specific reference to iPhone development.

    http://www.amazon.co.uk/gp/product/0321566157/
     
  4. macrumors 6502

    Joined:
    Oct 31, 2007
    Location:
    San José
    #4
    Isn't Garbage Collection part of Foundation?

    When I read Kochan's book the whole first half was devoted to Objective-C *independent* of Cocoa frameworks (which I think is a good way to learn). Wouldn't Kochan have to use retain counts if he wasn't using Cocoa?
     
  5. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #5
    Retain counts are a manual means of memory management. The runtime is just kindly enough to dealloc things when their retain count reaches zero for you, but there is no object graph used, and the reference counting is not done for you. The autorelease pool helps "automate" memory management, but is not a replacement for real garbage collection.

    It is somewhat confusing, as retain counts and the runtime dealing with deallocation for you does seem sort of "garbage collecty". However the garbage collection introduced in Objective-C 2.0 is what a programmer used to GC'd languages like Java, the .NET family, and many functional languages like Lisp and Haskell would expect. It is completely automatic, and the programmer doesn't have to directly deal with managing the retain/reference counts. The problem this can cause is leaking of references, which would be the same as leaking memory in the absence of GC, and can be quite difficult to track down.

    -Lee
     
  6. macrumors 68040

    Joined:
    Feb 17, 2008
    Location:
    Britain
    #6
    Preordered it a while back :)
     
  7. macrumors regular

    Joined:
    Apr 1, 2006
    Location:
    California
    #7
    Because garbage collection isn't supported on the iPhone, and because I believe it's important to understand object ownership, memory management is still emphasized throughout the second edition of the book. The primary changes to the second edition include the incorporation of the new objective-C 2.0 features (such as properties, synthesized accessors, and fast enumeration), the use of NSObject from the start as the root object (the first edition used Object), and a chapter that introduces how to write an iPhone application. All feedback is welcome.

    Cheers,

    Steve Kochan
     
  8. macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #8
    Hey Steve. I'm going through the first edition right now. I really like it. I read really slow and try to absorb as much as I can. I'm on chapter 15, and have only noticed one very insignificant typo so far. Very good job. I can't stand it when I'm "correcting the author" when I'm reading.

    Todd
     
  9. macrumors 6502a

    GorillaPaws

    Joined:
    Oct 26, 2003
    Location:
    Richmond, VA
    #9
    Hey Steve, I can't say enough good things about your book. I did find the bitwise operation section to be less polished than the rest of the text however, and it seems others on Amazon had commented on this as well. Did you happen to revisit that particular section in the 2nd edition at all?

    Also, do you have any interest in writing a learning Cocoa book for people who just finnished your Objective-C book, possibly in a joint effort with Hillegass'? One of my criticisms of Hillegass' excellent book is that it seems to lack the degree of detailed analysis of what the code is doing (even when it's repetition) that was present in your book. I found this strategy in "Programming in Objective-C" to be a critical part in the learning process for me, and think others trying to learn how to program for the first time on a Mac would really benefit from your lucid writing style.
     
  10. macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #10
    I thought the use of Object (vs NSObject) from the beginning was fine, as it allowed the reader to focus on the whole OO paradigm versus getting immersed straight into a huge framework from the get-go. Perhaps you can make a side-note of it's use in the appendix?
     
  11. macrumors regular

    Joined:
    Oct 14, 2005
    Location:
    Troy, NY
    #11
    This thread reminded me it was coming out soon. Fortunately, I received two B&N gift cards for Christmas so this time around there was absolutely no hesitation! :)
     
  12. macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #12
    In the new edition, are you getting rid of the deprecated methods like cString?
     
  13. macrumors member

    Joined:
    Feb 15, 2008
    #13
    Well here is a dilemma - I can't program at all. I want to write a enterprise web app. Lets say another Ebay. As of today my option seems only Java. However does anyone out there think we may see a Cocoa ability to create enterprise apps with the coming of ObjC 2?

    Now for anyone answering forget it period if you can't program then lets assume I am a expert but don't know Java or Obj C
     
  14. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #14
    Apple does have an enterprise web app solution. It is called Web Objects and is based on Java.
     
  15. macrumors member

    Joined:
    Feb 15, 2008
    #15
    Thank you Cromulent - I am very aware of WO. I am wondering if they will have a web app solution with Cocoa as they currently do not.
    WO was great when it had the tools
     
  16. macrumors regular

    Joined:
    Apr 1, 2006
    Location:
    California
    #16
    I had an expanded description of the bitwise operators in Programming in C, but I decided to scale it back for the Objective-C title. Bad decision! I restored the more detailed explanation in the second edition. There are now truth tables for all the operators, and the explanations are not so terse!

    Cheers,

    Steve Kochan
     
  17. macrumors regular

    Joined:
    Apr 1, 2006
    Location:
    California
    #17

    Yes, because this edition starts from the beginning with NSObject (instead of Object), I use NSLog almost exclusively instead of printf. That allows string objects to be displayed directly without having to first convert them to C-strings.
     
  18. macrumors regular

    Joined:
    Apr 1, 2006
    Location:
    California
    #18
    In the first edition, I was hoping Objective-C would really catch on as a cross-platform development language. Thus the use of Object instead of NSObject, and coverage of the Foundation Framework in the second part, which does allow portable, multi-platform applications to be developed.

    Five years later, Objective-C remains primarily a Mac application development language. So, I gave in and decided to start with NSObject out of the box, but there's still no real coverage of the framework (other the autorelease pool that XCode automatically sets up) until the second part of the book, which is consistent with the first edition.

    I also added another section to take the reader through the process of getting a program to run on an iPhone. In this case, the Calculator and Fraction classes that are developed throughout the text are used to develop a simple iPhone Fraction calculator. This serves as an introduction to the world of Cocoa and iPhone application development and ties everything together. By no means is this introductory chapter designed to replace any of the excellent Cocoa texts out there.


    Cheers,

    Steve Kochan
     
  19. macrumors regular

    Joined:
    Apr 1, 2006
    Location:
    California
    #19
    See my answer in #18. There is an introduction to iPhone development. You are taken through the steps involved in designing an iPhone Fraction calculator, including building the interface with Interface Builder. However, this is not a tutorial on iPhone or Cocoa programming, as it covers just developing two particular types of applications on the iPhone.

    Cheers,

    Steve
     
  20. macrumors regular

    Joined:
    Apr 1, 2006
    Location:
    California
    #20
    Thanks much. I have thought about it. Unfortunately, I'll have to leave it at that for now. :)
     
  21. macrumors newbie

    Joined:
    Dec 6, 2007
    Location:
    San Diego
    #21
    There are lots of alternatives, some of which run on the Mac. You didn't mention platform, so let me toss out the obvious Windows .NET suggestion. Other combinations based on Java include NetBeans/EJB/GlassFish and several different webapp environments that plug directly into Eclipse. Non-Java frameworks basically boil down to Ruby on Rails and PHP and *Sql on (your favorite unixy OS here). My favorite are BAPPs (BSD, Apache, PHP, PostgreSQL) but feel free to mix-n-match according to your own preferences.

    Xcode, NetBeans, and Eclipse all have editor support for the common web languages like Ruby and PHP these days, so you have an embarassment of riches at hand for development tools.

    I haven't found any web development frameworks written in Obj-C, or C or C++. I'm not sure of the reason, other than languages like PHP and environments like Rails have been designed with the flow of web programming in mind and have done a very good job. Java grew up with the web and so a large percentage of the "real programmers" that went into web programming did so with Java. The Java frameworks and servers that have survived are genuinely useful stable platforms with thousands (or more) users and useful documentation.
     
  22. macrumors member

    Joined:
    Feb 15, 2008
    #22
    thank you for your response. I guess maybe it is just wishful thinking that Mac would replace WO. I am trying Netbeans visual web and it seems to be coming along. I guess I will compare that to WOLips and rails after Macworld. It seems that many WO developers are migrating to Rails.
     
  23. macrumors 6502

    Joined:
    Jan 3, 2009
    #23
    Hi Steve...your new book arrived today. Just skimming through it, I see it has largely been rewritten with the new 2.0 features.

    I **assume** :) those questions incorporating new terminology are posted somewhere??? Could you let us know where these are, so the more industrious of us can **really** get to learn it. Thanks.
     
  24. macrumors regular

    Joined:
    Apr 1, 2006
    Location:
    California
    #24
    I'm not sure what you mean by questions. I assume you mean answers to exercises? No, the code and the answers to the exercises haven't been posted yet. I just got the book done before the holidays, so now I need to sit down and actually work out the answers to the even-numbered exercises, which I didn't even do for the first edition. It's quite a time consuming task (as I was writing some of the exercises I was grimacing at the thought of having to answer a couple of the harder ones myself). It's my top priority. I'm hoping to set up a web site shortly (or use my mac home page as I'm doing now) for errata, answers to exercises, and the source code from the book.

    Feel free to pester me! :)

    Here's a thought: I'll accept contributions (code, not $$$) for the even-numbered exercises via email, provide comments and give you credit if I use it. (Does that sound too desperate? :D)

    Cheers,

    Steve Kochan
     
  25. macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #25
    I can (try to) help with that. Now, where's that amazon link.... I've made it through page 400 of the first edition.
     

Share This Page