O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

GCD or NSOperation?

You have now seen two different ways of architecting your code to support task-oriented parallelism, NSOperation and Grand Central Dispatch.

With GCD, the code for a particular operation tends to be concentrated in one place. You have a block that does work and then puts blocks onto other queues to do other work – the whole layers of an onion thing. GCD is very fast. There is little baggage associated with it. There is no reliance on KVO. GCD calls tend to be more ad-hoc and disposable, I’ll just put this here to run this on the main queue kinds of things. Plus, it is easier to copy and paste and create similar blocks doing the same work.

NSOperation tends to have the code more spread around. The code implementing an ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required