Slashdot Mirror


Cocoa in a Nutshell

emmastory writes "The Nutshell series includes some of the most well-worn and useful technical books I own, and Cocoa in a Nutshell is one of the newer Mac-related additions to the collection. If you're familiar with the format of the series, probably the biggest question you'll have is whether or not this book is as good as the other Nutshell handbooks - the short answer is Yes, it's just as good as its predecessors." Read on to see the logic underlying that conclusion, in the rest of Emma's review. Cocoa in a Nutshell author Michael Beam, James Duncan Davidson pages 545 publisher O'Reilly rating 8 reviewer Emma Story ISBN 0596004621 summary A good overview of the language and API reference.

Cocoa is a great thing to learn, and if you've got some relevant experience with other languages, this book is a great way to learn it. It's one of the Apple Developer Connection recommended O'Reilly titles, and comprises a complete and thorough reference to the language that most Cocoa developers will appreciate.

I say most Cocoa developers rather than all of them because this is of course a Nutshell handbook - it's not intended to serve as a step-by-step tutorial for those without any prior Cocoa or object-oriented programming experience (for that, there's Learning Cocoa with Objective-C). Readers completely unfamiliar with the language may find the book a little bewildering, it's true. However, that's not to say you need to have already mastered the language before picking up the Nutshell book - the first part contains quite a decent introduction, and if you're already familiar with something like Java, this will probably be all you need. I have a couple of years of experience with C and Java myself, and although this was my first Cocoa book, I didn't feel lost when reading the book's first half.

Coauthor Michael Beam notes that "The 'In a Nutshell' format had always been a very efficient means of communicating information, particularly for more experienced developers. Cocoa is a very verbose and wordy API; that is, the method names are long and can have many arguments. It is often the case that a developer can be moving along in his code, and he knows what method to use, but can't remember the precise syntax. This book seeks to provide a quick way to look up that syntax." I think that's a goal it achieves admirably, and as long as readers are aware they're buying a reference and not a gentle introduction to programming, they won't be disappointed.

It's primarily the second half of the book that serves as a complement to Apple's documentation for the Foundation and AppKit classes. Apple's Cocoa site is better than it used to be, and it does include a basic API Reference along the line's of Sun's site for the Java API - you can use it for the kind of syntax-checking Beam is talking about, and many developers do just that. If you're already in the habit of looking things up on the Apple site, the API documentation in this book won't change your life. I prefer it to the web version, partially because there's slightly more explanation of the various classes, but not everyone will feel the same way.

So, who should buy this book? The intended audience is pretty much the same as that of the other programming-related Nutshell books. If you're completely new to programming, don't bother. You'll be much better off starting with something that assumes no knowledge of programming concepts and skills. On the other hand, if you're an experienced Cocoa developer who'd rather use Apple's Cocoa site than shell out for a book, there's really no reason to do so. But plenty of people don't fall into either of these categories. If you've got some OOP experience, and especially if you've already fumbled your way through a little bit of Cocoa but would like to learn more, you'll find the overview section very useful and the reference section convenient. (It's probably also worth noting that, at least at the moment, Amazon is offering Cocoa in a Nutshell for $15.98, down from $39.95. Even if you're not totally convinced it's worth forty bucks, it's definitely worth sixteen.)

You can also purchase Cocoa in a Nutshell from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page

94 comments

  1. What the hell? by ajlitt · · Score: 4, Funny

    Everyone knows the proper woodcut to put on the cover is a coconut, not some stupid dog.

    1. Re:What the hell? by bigcreek · · Score: 5, Funny

      You do know that cocoa doesn't come from a coconut, don't you?

    2. Re:What the hell? by Anonymous Coward · · Score: 0

      I think a clown (sad) would be most appropiate.

    3. Re:What the hell? by Anonymous Coward · · Score: 5, Funny

      Ugh!

      I bet next you'll say that peanuts don't come from peas, eh Mr. Smartypants?

    4. Re:What the hell? by ajlitt · · Score: 1

      Thanks, Dr. Science.

    5. Re:What the hell? by Gzip+Christ · · Score: 4, Funny
      Everyone knows the proper woodcut to put on the cover is a coconut, not some stupid dog.
      I was actually hoping this guy would make it on the cover.
    6. Re:What the hell? by adamofgreyskull · · Score: 1

      They are not so distantly related as you think...peanuts are legumes...

      As an aside..I'm greatly disturbed that there is a "peanut institute".

    7. Re:What the hell? by I_Love_Pocky! · · Score: 1

      Aww... are you sad that some one pointed out your mistake? Poor little boy. I'm so sad for you.

      Seriously though, don't mock someone for knowing something you don't. It makes you look even dumber. Any one should know that cocoa doesn't have anything to do with a coconut. I mean it certainly doesn't take a "Dr. Science."

    8. Re:What the hell? by dasmegabyte · · Score: 1

      It would hit too close to home, considering how many cuckoos use Maciontoshes.

      --
      Hey freaks: now you're ju
    9. Re:What the hell? by ajlitt · · Score: 1, Funny

      No, really, I wasn't being sarcastic. In fact, his insight kept me from wasting valuable work time as I was previously busy pondering the duality of a Mounds bar.

    10. Re:What the hell? by I_Love_Pocky! · · Score: 1

      Oh... I feel like an ass. Please disregard my comment then.

    11. Re:What the hell? by Concerned+Onlooker · · Score: 1
      not some stupid dog.

      Yes, but I believe the dog's name is Coco.

      --
      http://www.rootstrikers.org/
    12. Re:What the hell? by Anonymous Coward · · Score: 0

      -1, Didn't Get The Joke.

    13. Re:What the hell? by Anonymous Coward · · Score: 0

      The Leader Of The Free World says cocoa comes from coca leaves.

      10,000 nukes can't be wrong, liberal commie nutbag!!

    14. Re:What the hell? by obdurate · · Score: 1

      If it had to be a dog, it should have been Clarus the dogcow--that's almost a dog.

      Is "cocoa in a nutshell" redundant?

      --

      Nuclear war would certainly set back cable--Ted Turner
    15. Re:What the hell? by UserGoogol · · Score: 1

      Sometimes you feel like a nut, sometimes you don't.

      --
      "Never attribute to malice that which can be adequately explained by stupidity." -- Hanlon's Razor
    16. Re:What the hell? by Anonymous Coward · · Score: 0

      Well, at least we can be certain that donuts don't come from does.

      Homer: hmmm... donuts... *drool*

  2. Handed out free at last year's WWDC by remahl · · Score: 5, Interesting

    O'Reilly handed out the book for free at WWDC '03 ot all attendees. (I have to question how smart it can be to hand out a book for free to such a large portion of your target population).

    It looks nice, especially the part on the text system, but I can't say I've used it a lot in the year that has passed.

    1. Re:Handed out free at last year's WWDC by PCM2 · · Score: 4, Interesting
      (I have to question how smart it can be to hand out a book for free to such a large portion of your target population).
      O'Reilly has never been all that stingy with the freebies. It's possible that:
      1. The cost of the book was partially subsidized by your WWDC '03 enrollment fees
      2. O'Reilly wants to build mindshare among what remains a relatively new audience for them (Mac developers)
      3. In the long term, O'Reilly expects a significant portion of its business to come from the Safari service, rather than dead-tree editions.
      --
      Breakfast served all day!
    2. Re:Handed out free at last year's WWDC by benwaggoner · · Score: 4, Informative

      And you have to fill out a card with your contact info to get the book, and O'Reilly catalogs start showing up at your address a few weeks later.

      They're good catalogs - I don't mind.

  3. Food. by RedShoeRider · · Score: 0, Funny
    I never would have thought of mixing apples and cocoa....

    Chocolate covered apples, anyone?

    --

    Chris Knight is my hero.

    1. Re:Food. by Proud+like+a+god · · Score: 1, Insightful

      Come on people, it's funny. Laugh.

  4. The API is pretty well documented by Mrs.+Grundy · · Score: 4, Interesting

    I've flipped through the Cocoa nutshell book at the store. Personally, I didn't think it was worth it simply because the documentation and help browser are so nice in XCode. I mean you can option click or command click on a method or class and it takes you right there. What would be really nice is a book of cocoa design patterns and in-depth looks at some of the more confusing classes rather than a listing of classes and methods with little explanation.

    1. Re:The API is pretty well documented by dasmegabyte · · Score: 4, Insightful

      Well, when you're dealing with a 1024x768 display on a 600 MHz iBook, it's nice to have an external reference. JavaDocs are pretty good too, but my "Java in a Nutshell" series (including JFC in a nutshell and java enterprise in a nutshell) books are indispensible, despite each weighing more than the computer itself!

      --
      Hey freaks: now you're ju
  5. And vice versa ... by BabyDave · · Score: 5, Funny

    FYI, Amazon also sell nuts in a cocoa shell.

    1. Re:And vice versa ... by Anonymous Coward · · Score: 0

      Silly kid, peanuts aren't nuts.

    2. Re:And vice versa ... by BabyDave · · Score: 2, Funny

      Silly kid, peanuts aren't nuts.

      Fine, you pedantic bastard.

      [Damn lameness filter needs more characters per line.]

  6. "Cocoa in a Nutshell"? by Deraj+DeZine · · Score: 0, Funny

    So... a cocoanut? Is this that book written by the guy on that "Castaway" documentary?

    WILSON! WILSON!

    My name's Voit, moron!

    --
    True story.
    1. Re:"Cocoa in a Nutshell"? by Anonymous Coward · · Score: 0

      Oops, misquoted Family Guy. Guess I must have had my mild profanity filter on or something. ----! Yep.

    2. Re:"Cocoa in a Nutshell"? by dasmegabyte · · Score: 1

      Wilson was a volleyball, not a coconut, wasn't he?

      --
      Hey freaks: now you're ju
  7. Also try Learning Cocoa, an updated NeXT book by green+pizza · · Score: 4, Interesting

    The Nutshell books make for great reference material, but developers new to the NeXT / Mac OS X world would be better served by ORA's other book, Learning Cocoa. I paged thru this book a few weeks ago at a Barnes and Noble... the book is an updated version of the getting started guide NeXT published years ago... I highly recommended the original back then and still think it's a great way to learn NS / Cocoa as well as Objective C.

    1. Re:Also try Learning Cocoa, an updated NeXT book by fsmunoz · · Score: 4, Informative

      Very true; I actually learnt the OpenStep API by using that NeXT book you mention and some GNUstep tutorials. My Obj-C experience is only on GNUstep (not Cocoa), but the information needed is the same.

      On that note my next buy will be Programming in Objective-C; the reviews seem to indicate that it's a good book *and* ina rather unusual fashion as examples for both Cocoa and GNUstep.

    2. Re:Also try Learning Cocoa, an updated NeXT book by Dylan+Zimmerman · · Score: 4, Informative

      I would think that people entirely new to Objective-C and Cocoa would be best served by Cocoa Programming For Mac OS X, which was written by Aaron Hillegass. Hillegass worked at NeXT back when Cocoa was still called OpenStep and he went to Apple when they bought NeXT to teach the Apple developers about it. He wrote the first course on OpenStep programming and he's the founder of Big Nerd Ranch, arguably the best place for Cocoa classes.

      It's a very good book. In it, he goes through everything from building a basic console app through building a simple editor for SGML.

  8. Cocoa developers best friend by Juanvaldes · · Score: 5, Informative

    AppKiDo It parses the cocoa docs installed by XCode for quick easy access.

    1. Re:Cocoa developers best friend by Deraj+DeZine · · Score: 2, Funny

      Me: "So I just have one question: why couldn't the docs be taken straight to the customers?"

      XCode: "Look, I already told you! I deal with the customers so the engineers don't have to! I have people skills! I am GOOD at dealing with PEOPLE! What the heck is wrong with you people??"

      --
      True story.
  9. Title by MisanthropicProgram · · Score: 1
    Learning Cocoa with Objective-C

    Shouldn't that be
    Shelled Cocoa

  10. If you're doing a small Cocoa app... by tcopeland · · Score: 4, Informative
    ...you might want to look at the RubyCocoa Objective C bridge.

    For example, here's a script (from the RubyCocoa home page) that plays the system sounds:
    require 'osx/cocoa'
    snd_files =`ls /System/Library/Sounds/*.aiff`.split
    snd_files.ea ch do |path|
    snd = OSX::NSSound.alloc.
    initWithContentsOfFile_byReference (path, true)
    snd.play
    sleep 0.5
    end
    Although he probably could have use Dir.glob rather than parsing the output of ls, but, anyhow...
    1. Re:If you're doing a small Cocoa app... by zephc · · Score: 4, Informative

      and for Python users out there, here's the very capable PyObjC.

      --
      "I would say that 99 per cent of what my father has written about his own life is false." - L. Ron Hubbard Jr.
    2. Re:If you're doing a small Cocoa app... by dynamo · · Score: 3, Informative

      Or, of course, you can use perl with CamelBones.

    3. Re:If you're doing a small Cocoa app... by fsmunoz · · Score: 1
      People interested in Ruby and Cocoa might be interested in GNUstep RIGS, which is a Ruby binding to GNUstep.

      It seems that RIGS is similar in intent to RubyCocoa. A simple example:
      require 'rigs'
      require 'Foundation'
      $STRING_AUTOCONVERT = false
      $SELECTOR_AUTOCONVERT = false
      begin
      a = NSString.new
      a.initWithCString("Another init value. One too much...")
      rescue NSInternalInconsistencyException => reason
      print "Exception caught! No fear we did it on purpose :-)\n"
      end
      b = NSString.stringWithCString("GNUstep for ever")
      c = NSMutableString.stringWithCString("GNUstep for a while")
      f = NSString.stringWithCString("3.25")
      d = AT"String created with the AT shorcut"
      print "a length =",a.length,"\n"
      print "c length =",c.length,"\n"
      print "d length =",d.length,"\n"
      print "b length =",b.length,"\n"
      puts b.capitalizedString.cString
      puts b.uppercaseString.cString
      puts d.uppercaseString.cString
      print "a isEqualToString a: ", a.isEqualToString(a),"\n"
      print "b isEqualToString c: ", b.isEqualToString(c),"\n"
      print "d isEqualToString c: ", d.isEqualToString(c),"\n"
      print "f as a floating point number = ",f.floatValue,"\n"
      print "d as a double floating point number = ",f.doubleValue,"\n"
      array = NSMutableArray.new
      rbarr = [1,2, "2345", nil]
      rbhash = {"Saint Emilion" => "Bordeaux",
      "Meursault" => "Bourgogne",
      "Pommard" => "Bourgogne"}
      array.addObject(rbarr)
      array.addObj ect(b)
      array.addObject(rbhash)
      printf "There are %d elements in the NSArray object\n",array.count
      print "Array Description:\n",array.description.cString,"\n"
      pr int "Is rbhash in array? Answer: ",(array.containsObject(rbhash) ? "yes":"no"),"\n"
      print "2nd element of array is: ",array.objectAtIndex(2),"\n"
      puts "--End--"


      This is actually a test so probably better examples exist (e.g. CurrencyConverter.app is available in RIGS)
    4. Re:If you're doing a small Cocoa app... by Anonymous Coward · · Score: 0

      F-Script is a great scripting language for Cocoa.

  11. Might be worth waiting by YouHaveSnail · · Score: 5, Informative

    It's probably also worth noting that, at least at the moment, Amazon is offering Cocoa in a Nutshell for $15.98, down from $39.95.

    That's probably a good indication that a new edition is on its way. Like most other frameworks, Cocoa is constantly growing. Apple recently added the controller layer and key value binding to support it. These things are important, but they aren't mentioned in the Nutshell book right now. $16 isn't a bad deal for a slightly out of date edition, IMO, but if you want a complete reference, wait a month or two. WWDC is coming up, and I would be surprised if O'Reilly didn't update this volume then.

    Besides, if you're using Xcode, or even if you're not, you hardly need a paper reference to Cocoa. Xcode's code completion feature really helps jog your memory, and full documentation for all the classes is just a click or two away.

  12. It's good marketing. by ArsSineArtificio · · Score: 5, Insightful
    I have to question how smart it can be to hand out a book for free to such a large portion of your target population

    It's pretty smart. O'Reilly aren't banking on the WWDC attendees only ever buying this one of their books. But they are banking on them being interested in this one, and from that gaining a favorable impression of them and their products.

    --
    All employees must wash hands before seeking equitable relief.
  13. O'Reilly Upgrades by Colol · · Score: 4, Informative

    Don't forget O'Reilly offers upgrades to their books. If you absolutely must have Cocoa in a Nutshell now, snag it from Amazon and then send in your title page and $27.97 when the new edition arrives. Cheaper than buying the old edition at full price and then upgrading to the newer.

    If you can wait, of course, you'll get it cheapest of all.

  14. Also known as... by Anonymous Coward · · Score: 0

    ...a cappuccino.

  15. Re:Might be worth waiting; where to look by David+Hume · · Score: 4, Informative

    That's probably a good indication that a new edition is on its way. Like most other frameworks, Cocoa is constantly growing. Apple recently added the controller layer and key value binding to support it. These things are important, but they aren't mentioned in the Nutshell book right now. $16 isn't a bad deal for a slightly out of date edition, IMO, but if you want a complete reference, wait a month or two. WWDC is coming up, and I would be surprised if O'Reilly didn't update this volume then.


    Well, there is no new edition of Cocoa in a Nutshell listed on the O'Reilly New and Upcoming Titles Page. Then again, the upcoming titles list only goes through June. Perhaps we can expect the new edition in July. ;) If you are interested in the book, it might be a good idea to keep an eye on this page.

  16. Re:Might be worth waiting; where to look by Anonymous Coward · · Score: 0

    Given that WWDC is at the end of June, it's entirely likely to be a new edition coming soon. O'Reilly gave everybody one last year, if I recall correctly. I have one on the shelf and I don't remember buying it. I'm not much of a GUI person despite meaning to do more with it.

  17. Obligatory Cereal Joke... by sdjunky · · Score: 1, Funny

    I'm coo coo for Cocoa Nuts (oh, shell... nevermind)

  18. problem with cocoa books by OmniVector · · Score: 4, Informative

    how can you properly use a language without understand what makes the language fundamentally different from others? each language has it's own set of useful features that make certain design patterns obsolete or easier. none of them cover the CORE of cocoa! obj-c. they all do a half-assed job in my opinion, so i bought and read a book just on objective-c. i highly recommend Programming in Objective-C by Stephen Kochan. I've written a large tutorial on the objective-c language by itself based off of many of his examples, and have provided links to other objective-c tutorials and cocoa/obj-c books at the bottom of the page.

    --
    - tristan
    1. Re:problem with cocoa books by ILL+Clinton · · Score: 1
      they all do a half-assed job in my opinion, so i bought and read a book just on objective-c. Programming in Objective-C

      Would you say then, in your opinion, that this book does a full-assed job?

    2. Re:problem with cocoa books by fsmunoz · · Score: 1

      Hey, nice tutorial. I'll be reading it for the next days :)

      And you're very right in your assertion... once one has the basics on how to send messages to objects etc. it's easy to forget about Obj-C proper and delve in the OpenStep API, but I've found myself doing really stupid things just to compensate my lack of knowledge of Obj-C.
      The GNUstep Tutorials have been a blessing in that regard, and your tutorial is actually quite nice.

      I'm also planning to buy that book, everybody seems to have it in high regard.

  19. Cocoa - GNUStep by Moderation+abuser · · Score: 4, Informative

    For anyone interested, GNUStep implements the Cocoa API.

    http://www.gnustep.org/

    --
    Government of the people, by corporate executives, for corporate profits.
    1. Re:Cocoa - GNUStep by Geoffreyerffoeg · · Score: 2, Informative

      That is, of course, because GNUStep implements NEXTSTEP, and Apple bought Steve Jobs' NeXT and based Mac OS X on NEXTSTEP. We get Objective C mainly from NeXT.

    2. Re:Cocoa - GNUStep by Archibald+Buttle · · Score: 2, Informative

      From what I have gathered GNUstep only implements a subset of the Cocoa API - not surprising since Apple is constantly updating Cocoa.

      Additionally most reports about GNUstep are that it is very difficult to install...

      Ideally I'd like to be able to install GNUstep on my Mac and have it integrated with XCode so that I could compile versions of my apps for other platforms.

    3. Re:Cocoa - GNUStep by CRCulver · · Score: 1

      That is, of course, because GNUStep implements NEXTSTEP, and Apple bought Steve Jobs' NeXT and based Mac OS X on NEXTSTEP.

      GNUstep doesn't "implement NEXTSTEP." There is no standard by that name. GNUstep does, however, implement OpenStep, a standard worked out mostly by Sun from the development environment created by NeXT. An excellent resource for understanding the terms and their cApItaliZATIONS is OpenStep Confusion

    4. Re:Cocoa - GNUStep by CRCulver · · Score: 1

      From what I have gathered GNUstep only implements a subset of the Cocoa API - not surprising since Apple is constantly updating Cocoa.

      GNUstep has implemented a number of Cocoa extensions. NSToolbar, for example, was just added. It is true that some extensions are missing, but if in the course of porting an application you notice that a class is missing, just let the GS core developers know and I'm sure they'd be happy to work on it right away. The GNUstep team is excellent in responding to the needs of developers.

      Additionally most reports about GNUstep are that it is very difficult to install...

      On certain platforms that may still be the case. However, more and more Linux distributions, such as Gentoo, have packaged all the necessary libraries, so GNUstep isn't more of a pain than any other piece of prepackaged software.

  20. *sniff* by NilObject · · Score: 1

    The link: http://www.oreilly.com/catalog/cocoaian/ Kinda makes you wonder, don't it?

    Even 14 year old cokeheads can spell it.

  21. Porn in a Nutshell? by Anonymous Coward · · Score: 0

    The Nutshell series includes some of the most well-worn and useful technical books I own

    Never have truer words been spoken, as O'Reilly just released an update to Porn In A Nutshell

    1. Re:Porn in a Nutshell? by Anonymous Coward · · Score: 0

      That link doesn't work. O'Reilly wanted me to let you know.

      "Error

      We're sorry, the URL, http://www.oreilly.com/catalog/pornian/ is either incorrect or no longer available.

      If you followed this link from outside of one of our sites, we'd appreciate if you'd let the owner of the referring page know. If you followed it from within our sites, or if you believe you received this message in error, please send e-mail to help@oreillynet.com and let us know that you got error 404 looking for http://www.oreilly.com/catalog/pornian/ which was linked to on page http://books.slashdot.org/article.pl?sid=04/04/13/ 0223229&mode=nested&tid=107&tid=126&tid=156&tid=18 7 ."

  22. Look online instead by akuzi · · Score: 4, Informative

    There is nothing in this book that isn't on the developer cd documentation or online.

    'Cocoa in a nutshell' contains a short introductory chapter on Obj-C, one on the Foundation library, one on App-Kit, one on Quartz and a few others, they're okay but not great.

    If you want to learn Obj-C you'd be better of reading:

    http://developer.apple.com/documentation/Cocoa/C on ceptual/ObjectiveC/

    After that the rest of the book is a big Javadoc-style API reference to all of Cocoa.

    If you really need it in dead-tree form then maybe it's useful, but otherwise look at:

    http://developer.apple.com/referencelibrary/Coco a

  23. "Cocoa in a Nutshell" by TBone · · Score: 1

    Wouldn't it be hard to drink very much that way? I mean, even if it's a walnut shell, that's what, half an ounce at a time, at the best, if you hollow it out?

    --

    This space for rent. Call 1-800-STEAK4U

  24. Use an external display at higher resolution... by willy_me · · Score: 1

    Check this out.

    1. Re:Use an external display at higher resolution... by v01d · · Score: 1

      My main monitor is a 21" Sun. Works great with my iBook, but I'm not about to carry it with me (75 lbs.) to the local coffee shop. (Stauf's. Great coffee.)

    2. Re:Use an external display at higher resolution... by dasmegabyte · · Score: 1

      Great advice. I should castrate the portability of my machine by buying a $200+ monitor rather than invest in a $40 book.

      I love slashdot. Where else can you get convoluted non-solutions to non-problems?

      I mean, besides in government.

      --
      Hey freaks: now you're ju
  25. Mmmmmmmmm.... by warrior · · Score: 1

    ...cocoa in a nuuut-shellll... *argle* *argle*

    --
    Intel transfer the difficult from Hadware to software, for get more power, programmer need more technology. -- chinaitn
  26. the logic underlying that conclusion by riffenator · · Score: 1

    its very clean.
    Its certainly not contaminated by cheese.

  27. oh, thats an easy one by Anonymous Coward · · Score: 0

    Cocoa - warm milk, powdered chocolate. serve to taste.

    They actually wrote an entire /book/ about that?

  28. Pesticide is murder by Graymalkin · · Score: 1

    The Objective-C Pocket Reference from ORA is an awesome companion to any and all Cocoa and Objective-C books. It gives a good overview of the language as long as you've got some previous OO programming knowlege. One of its best features is its platform agnosticism. The compiled used with all of the examples is gcc so its quirks and foibles are explained and noted where applicable. You'd also be hard pressed to find one of the examples in the book that didn't run equally well on the GNU and Darwin runtimes. For a good primer on the language it is a really nice handbook and could get a moderately experienced programmer up to speed with Objective-C in an afternoon.

    --
    I'm a loner Dottie, a Rebel.
  29. Missed the point by willy_me · · Score: 1
    I guess I should have elaborated..

    I mentioned the link because it normally isn't possible to do this with an iBook / iMac / eMac - they only support monitor mirroring. The previous link tells of a patch that allows your external display to act as a separate monitor - basically extending your desktop. It turns a cheap iBook into a powerbook, well, almost.

    I'm not saying to not get a book, I personally love books. But the page I liked to will allow a person to extend their desktop for free. A hand utility for anyone with an iBook / iMac.. Just thought some people reading this might like to know about it.

    William

  30. Cocoa Programming by Anonymous Coward · · Score: 1, Informative

    Programming in Objective C is a great book if that's what you want to do: learn to program in Objective C. But if you want to learn Cocoa, there's one book to beat. Cocoa Programming by Anguish, Buck, and Yacktman, three coding demigods of NeXTSTEP.

  31. Some comments on the tutorial by Anonymous Coward · · Score: 0

    0. You state that NSObject is short for NeXTSTEP Object, but you don't say WHY -- which is important! Objective-C does not have namespaces (like Java packages). But NeXT programmers often sold or gave objects to one another. NeXT's approach to dealing with classname clashes was to establish an 'initials registry': all objects in a library would have unique names because they would be prepended with initials of the organization providing the library. For example, all of OmniGroup's objects have 'OW' for OmniWeb I believe. Likewise, all standard NeXTSTEP objects (after version 3.2) were prepended with 'NS' -- NeXT's chosen initials in the registry. This practice continues to this day, and it is very wise.

    1. Not only are protocols similar to Java interfaces, Java interfaces were explicitly (and famously) created based *on* Objective-C protocols, as much of the later Java team were ex-NeXT. Similarly, Java's Double, Integer etc. classes were inspired by the same wrapper classes in Objective-C.

    2. Your description of release and autorelease is confusing: you imply that for every retain there must be exactly one release/autorelease. That's true. But there must also be a release/autorelease for every init as well. init does an implied retain. The old text "Object Oriented Programming and the Objective C Language" put it best:

    - if you create an object with init, you own it and are required to release/autorelease it.

    - if you receive an object from another source and wish to hold onto it, you should retain it; but then you are responsible for releasing/autoreleasing at some point to undo the retain.

    - if you create a factory method which builds an object solely for the purpose of handing it to the calling function, you should autorelease it before returning the function.

  32. Re:Mmmmmmmm.... by Anonymous Coward · · Score: 0

    Hey moderator, go fuck yourself with a broken bottle.