Linked by Eugenia Loli on Mon 24th May 2004 06:48 UTC
Mac OS X More than two years ago we reviewed the first edition of the excellent book by Aaron Hillegass, "Cocoa Programming for Mac OS X". The second edition has just being released and we will be taking a quick look as to what's new.
Order by: Score:
Does the sample code work this time?
by Anonymous on Mon 24th May 2004 11:27 UTC

I tried the previous edition, I think after seeing the review here, and was not impressed when the first bit of sample code called non-existant methods and would not compile.

NSController classes covered?
by techtrucker on Mon 24th May 2004 12:03 UTC

Does anyone know if the new NSController class is covered in the new book?
I thought the first edition was pretty good, got me over a few hurdles...

Doesn't recommend Java/Cocoa integration??
by ThreeHits on Mon 24th May 2004 12:18 UTC

I was hoping to check into this book as a resource for Java/Cocoa programming. However, looking at the Amazon description, it indicates that the author lightly covers the topic but does not recommend using the two together.

Anyone know why or have more info on this?

Actually, if the two don't really play well together, this is another reason to dive into GCJ's native compilation of java code (see topic from a few days ago on osnews)..

re: threehits
by John Timmer on Mon 24th May 2004 12:44 UTC

Like most people who have been using Cocoa since it was NeXT, the author believes ObjC is THE ANSWER, so it's not surprising that he recommends it. At the time of the first edition, there were still a lot of bugs in the Java/ObjC bridge, so he justifiably recommended against using Java with Cocoa. My understanding is that a lot of those bugs have been squashed, so there's less reason to avoid it. That said, Java apps launch slowly because they have to wait for its runtime to launch, and Cocoa was designed for use with ObjC, so it will always be a better fit with that language.

Going with GCJ won't help with most of these issues, because they are language issues, not compiler issues. An example off the top of my head is that lots of things in Cocoa still use C-style structs (ie - window areas are defined as a rectangular "frame" struct with an origin and size, which are in turn both structs). Since Java doesn't allow primitives like this, the whole thing has to be reworked and new classes created to handle these things.

Cheers,

JT

ATTN: techtrucker
by jerek on Mon 24th May 2004 14:34 UTC

yep.. the NSController class is cover in this text. i have the text in my hands now.. and see that it's chapter 6. ;)

Nice Book!
by Slack on Mon 24th May 2004 14:55 UTC


I received a preview copy when I went to Big Nerd Ranch in April and I must say excellent book, excellent instructor!

Bindings!
by Slack on Mon 24th May 2004 14:56 UTC


Also, this is the only book to cover Bindings, I believe.

I know...
by Nicolas Roard on Mon 24th May 2004 15:31 UTC

GNUstep doesn't have implemented most of Cocoa's API

Are you sure ? 90% (if not more) of Cocoa API is OpenStep, which GNUstep implements. Additions to OpenStep API could exist ot not in GNUstep, but many are (NSDocument, NSToolbar, etc.). What's missing is NSDrawer, the XML classes (because GNUstep already have ones, and you could use others framework like skyrix-xml -- but compatible classes will appear anyway), and some recent additions like the controllers stuff (panther).

I've read part of this book, and the author does not agree with using Java to build Cocoa apps. He says if you want to use Java, it's better to use the Swing API because that is portable, while Cocoa/Java only exists on the Mac.

native written
by spaceboy29 on Mon 24th May 2004 17:10 UTC

I should buy a copy for Adobe and send it to them considering the bad port of Premiere 6.5 a few years ago. It's no wonder why they dropped mac support, because it ran so horribly on OS X. I'm almost positive it was a carbon app, can anyone give me any knowledge on that? Cocoa app's run so much better on OS X.

Objective-C
by omnivector on Mon 24th May 2004 17:27 UTC

I'm surprised at the number of cocoa/gnustep articles lately on osnews. As usual for those coders who are somewhat interested in the API and want a brief overview, i recommend checking out my objective-c tutorial at http://otierney.net/objective-c.html

Objective-C is a great language for any platform; Windows, Linux, OR Mac.

Objective-C
by Nick on Mon 24th May 2004 17:42 UTC

"NOTE: Exception handling is only supported in Mac OS X 10.3"

Is this still true? That would be a major bummer.

by PantherPPC on Mon 24th May 2004 17:56 UTC

" I'm almost positive it was a carbon app, can anyone give me any knowledge on that?"

Yes, it sure was. It takes a long time to rewrite large complicated apps like that. Even the Finder, iTunes, and QuickTime Player are stil carbon. A large part of the reason they dropped it for OS X was the next version was a complete rewrite, even on Windows, and the effort for writing two completely different versions (Windows and OS X) when one wasn't going to sell very well against FCP just wasn't worth it.

Exception handling
by Nicolas Roard on Mon 24th May 2004 18:22 UTC

"NOTE: Exception handling is only supported in Mac OS X 10.3"

Is this still true? That would be a major bummer.


No, exception handling in ObjC existed way before OSX 10.3; but a new exception handling mechanism was introduced in 10.3, and _this_ mechanism isn't supported on older apple gcc (nor it is on the fsf gcc for the moment, by the way), which is quite normal.

Cocoa
by Trausti on Mon 24th May 2004 20:31 UTC

After a few weeks of cocoa and a few books bought I am well on my way of doing my first real cocoa app. OBJ-C is really cool language and after trying out perl and java bindings and a lot of different things I learnt a lot and found obj-c a really easy and cool language, I am most likely bying this book

Exception handling
by Nick on Tue 25th May 2004 00:14 UTC

So what exactly has changed? Just curious...

re: Exception handling
by Nicolas Roard on Tue 25th May 2004 00:36 UTC

Well, it should be safer than the previous mechanism; the syntax has changed too, to be quite java-ish. Before, you had:

NS_DURING
// Your code
NS_HANDLER
// The exception handler
NS_ENDHANDLER

now, you'll have:

@try {
// Your code
}
@catch {
// The exception handler
}

Plus, you'll have the possibility of using a finalize block.

More infos on http://gcc.gnu.org/onlinedocs/gcc/Objective-C-Dialect-Options.html

Great book thanks
by Peter Watling on Thu 3rd Jun 2004 02:23 UTC

I've struggled with a number of cocoa books in the past, but never really got my head around it. I'm not sure if it's just me coming back to it fresh, or the way this book teaches, but it all makes sense to me now. Many thanks Aaron.