Book Reviews
Pro .NET 4 Parallel Programming in C# by Adam Freeman
ISBN:
978-1430229674
Publisher:
Apress
Pages:
328
Last month I wrote about "Design Patterns for Decomposition and Coordination on Multicore Architectures" . The patterns target the .NET framework and build heavily on the .NET 4 parallel programming constructs. While providing detailed code samples capturing the idiomatic usage in C#, the book doesn't really focus on the language details. Rather, a potential reader is expected to master the basics in order to make qualified decisions and balance trade-offs between different implementation techniques when applying the patterns. My idea when starting to read Pro .NET 4 Parallel Programming was that the book would fill the role as preparation for such high-level material. I hope you caught my usage of past tense. Even if things looked promising, all expectations fell flat.
In any technical book I expect to get an initial overview by reading the table of contents. From here, things look quite decent. After the obvious introduction to parallel programming the book seems to take a fast pace covering, tasks, data sharing,parallel loops, parallel LINQ and even some stuff on testing and debugging. If covered in enough details, such a content is indeed interesting. So, what went wrong? Let's start by discussing something fundamental. Something like the code.
I do advocate and expect code in programming books. Lots of code, actually. And Pro .NET 4 Parallel Programming is full of it. However, that's just from a quantitative aspect. What looked promising initially, soon turned out as a source of constant disappointment. With virtually no exceptions, the samples are blocks of repetitive code snippets far removed from any resemblance with production code of even acceptable quality. While some samples manage to get their points along, others, like the thread local storage (TLS) samples, are a complete mess. The examples have been dumbed-down to a level where they fail to communicate the problem discussed. So, the samples fail their pedagogical purpose. From a design perspective things get even worse. The programs regularly violate multiple solid design principles, most notably TDA. The result is a wall of code with a brittle procedural structure.
Until now, I've never managed to write about parallel programming without mentioning Erlang (like here , here and here ). By design, Erlang gets rid of so much unnecessary complexity inherent in the traditional techniques for parallelism. I won't go down that path this time. But I'll point to an Erlang book to illustrate how a successful teaching project like this is executed. Erlang and OTP in Action walks the reader through production-quality code solving real problems. Such a work not only introduces a particular subject; it serves as a starting point for the reader to continue explorations within the domain. It also becomes a way to share expertise through idioms and valuable insights into the language. Sure, it's much harder, but why write a book if it doesn't provide value? Even if assembling interesting content, Pro .NET 4 Parallel Programming gives the impression of an effort with little thought or creativity behind it. At the end, I did try hard to come up with some positive aspect of the book. Sure, the writing style itself is decent. But with the name of the author as a possible exception, there's little that attracts me to this book.
Reviewed April 2011