Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

Create Account  |  Retrieve Password

Cocoa in a Nutshell

Posted by timothy on Tue Apr 13, 2004 01:10 PM
from the no-this-is-cocoa-in-a-nutshell dept.
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 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

+ -
story
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More
Loading... please wait.
  • by ajlitt (19055) on Tuesday April 13 2004, @01:13PM (#8850734) Homepage
    Everyone knows the proper woodcut to put on the cover is a coconut, not some stupid dog.
  • by remahl (698283) on Tuesday April 13 2004, @01:14PM (#8850755)
    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.
    • by ArsSineArtificio (150115) on Tuesday April 13 2004, @01:43PM (#8851120) Homepage
      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.

    • by PCM2 (4486) on Tuesday April 13 2004, @01:48PM (#8851174) Homepage
      (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.
  • by Mrs. Grundy (680212) on Tuesday April 13 2004, @01:16PM (#8850776) Homepage
    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.
  • by BabyDave (575083) on Tuesday April 13 2004, @01:17PM (#8850788)
    FYI, Amazon also sell nuts in a cocoa shell [amazon.com].
  • by green pizza (159161) on Tuesday April 13 2004, @01:21PM (#8850853) Homepage
    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.
    • 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 [samspublishing.com]; the reviews seem to indicate that it's a good book *and* ina rather unusual fashion as examples for both Cocoa and GNUstep.
    • 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.
  • by Juanvaldes (544895) <`cc.citsigrenys' `ta' `trownhoj'> on Tuesday April 13 2004, @01:21PM (#8850863) Homepage
    AppKiDo [mac.com] It parses the cocoa docs installed by XCode for quick easy access.
    • 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??"
  • Learning Cocoa with Objective-C

    Shouldn't that be
    Shelled Cocoa

  • by tcopeland (32225) * <tom&infoether,com> on Tuesday April 13 2004, @01:31PM (#8850990) Homepage
    ...you might want to look at the RubyCocoa [imasy.or.jp] 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...
  • by YouHaveSnail (202852) on Tuesday April 13 2004, @01:33PM (#8851017)
    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.
    • O'Reilly Upgrades (Score:5, Informative)

      by Colol (35104) on Tuesday April 13 2004, @01:44PM (#8851131)
      Don't forget O'Reilly offers upgrades [oreilly.com] 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.
    • by David Hume (200499) on Tuesday April 13 2004, @01:52PM (#8851214) Homepage

      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 [oreilly.com]. 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 [oreilly.com].

  • I'm coo coo for Cocoa Nuts (oh, shell... nevermind)
  • by OmniVector (569062) <see my homepage> on Tuesday April 13 2004, @02:07PM (#8851360) Homepage
    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 [amazon.com] by Stephen Kochan. I've written a large tutorial [otierney.net] 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.
    • 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?

    • 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 r
  • Cocoa - GNUStep (Score:5, Informative)

    by Moderation abuser (184013) on Tuesday April 13 2004, @02:47PM (#8851852)
    For anyone interested, GNUStep implements the Cocoa API.

    http://www.gnustep.org/

    • 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.
    • 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.
  • The link: http://www.oreilly.com/catalog/cocoaian/ Kinda makes you wonder, don't it?

    Even 14 year old cokeheads can spell it.
  • Look online instead (Score:5, Informative)

    by akuzi (583164) on Tuesday April 13 2004, @03:16PM (#8852229)
    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
  • 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?
  • ...cocoa in a nuuut-shellll... *argle* *argle*
  • 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.