It seems to me that GCD might make it easy to screw up in new ways.
Look at John Siracusa’s review of GCD at ArsTechnica. (Really, look at it, because I’m not going to summarize it here.)
Siracusa correctly describes the frustrations end users might have with the pre-GCD code. Something like:
There are ways to deal with these problems, but it’s not trivial. If programmers try to dispatch the analysis with just two lines of code like the ArsTechnica review suggests, they’re going to introduce some nasty bugs.
If developers believe all the hype that is going around about how simple GCD is, and that they can dispatch the analysis to another thread with just two lines of code like ArsTechnica tells us, we’re in for a flood of new bugs. If programmers who don’t understand the issues involved in multi-threaded programming start to believethat they can write multi-threaded programs because everybody’s telling them that GCD makes it easy, they’re going to write bad code.
On the other hand, if developers are careful when they use GCD, they will quickly realize that it’s a lot of work, and the luster will come off of the hype that’s going around with everybody claiming that GCD makes multi-threaded programming easy. Easier than POSIX threads or other multi-threading libraries, sure, but nowhere near as easy as is generally being claimed. Creating, dispatching, and waiting for jobs takes less code with GCD than with POSIX threads, but really, dealing with the Pthreads API has never been the biggest challenge in designing thread-safe code. Claims like “GCD doesn't require developers to think about how best to split the work of their application into multiple concurrent threads” are dangerous.
I don’t mean to pick on Siracusa. ArsTechnica isn’t the only one claiming that the process of making your application multithreaded becomes almost trivial with GCD. It’s the same all over with everybody saying, “Look at all you can do with just two additional lines of code!”
Look at John Siracusa’s review of GCD at ArsTechnica. (Really, look at it, because I’m not going to summarize it here.)
Siracusa correctly describes the frustrations end users might have with the pre-GCD code. Something like:
Siracusa says GCD can be easily used to make the analysis asynchronous, with just two extra lines of code. However, he neglects to consider what the user experience would be like with his suggested changes:USER: <click>
MAC: [“Analyze” button visibly depresses for a moment. The spinning Beach Ball appears.]
USER: [drums fingers for a few seconds...] “HOW COME THIS MAC IS SO &@%^)@ SLOW?!!!”
Great, now that long analysis is going to be performed repeatedly. Also, Siracusa’s suggested change invites the user to continue editing the document while it is being analyzed, which is asking for trouble.USER: <click>
MAC: [“Analyze” button visibly depresses for a moment.]
USER: [drums fingers few a few seconds...] “Hey, how come nothing’s happening?” <click> [pause] “What’s going on?” <click><click><click>
There are ways to deal with these problems, but it’s not trivial. If programmers try to dispatch the analysis with just two lines of code like the ArsTechnica review suggests, they’re going to introduce some nasty bugs.
If developers believe all the hype that is going around about how simple GCD is, and that they can dispatch the analysis to another thread with just two lines of code like ArsTechnica tells us, we’re in for a flood of new bugs. If programmers who don’t understand the issues involved in multi-threaded programming start to believethat they can write multi-threaded programs because everybody’s telling them that GCD makes it easy, they’re going to write bad code.
On the other hand, if developers are careful when they use GCD, they will quickly realize that it’s a lot of work, and the luster will come off of the hype that’s going around with everybody claiming that GCD makes multi-threaded programming easy. Easier than POSIX threads or other multi-threading libraries, sure, but nowhere near as easy as is generally being claimed. Creating, dispatching, and waiting for jobs takes less code with GCD than with POSIX threads, but really, dealing with the Pthreads API has never been the biggest challenge in designing thread-safe code. Claims like “GCD doesn't require developers to think about how best to split the work of their application into multiple concurrent threads” are dangerous.
I don’t mean to pick on Siracusa. ArsTechnica isn’t the only one claiming that the process of making your application multithreaded becomes almost trivial with GCD. It’s the same all over with everybody saying, “Look at all you can do with just two additional lines of code!”