Visual Studio 2010!

Read now >

View Now
DevSource RSS FEEDS
XML Want an easy way to keep up with breaking tech news? And the Get DevSource headlines delivered to your desktop with RSS.
ADVERTISEMENT
ADVERTISEMENT

 

DevSource.com: Your Source for Visual Studio on Facebook
ADVERTISEMENT
Book Review: C# 2008 and 2005 Threaded Programming
By John Mueller

Rate This Article: Add This Article To:

John Mueller reviews the book C# 2008 and 2005 Threaded Programming by Gastón C. Hillar.

C# 2008 and 2005 Threaded Programming by Gastón C. Hillar. 395 pages, Packt, January 2009. $39.99 ISBN: 978-1-847197-10-8. Visit the publisher's web site here.

Most machines today come with multiple processors or at least processors that have multiple cores (both of which count as multiple processors as far as Windows is concerned). If you’re still using single processor programming techniques, then you aren’t creating the most efficient application possible. In fact, you may very well be wasting computer resources and causing unnecessary delays.

Until recently, developers tended to ignore multiple processors for generalized programming for good reason. The most important reason was that few desktop machines had the required hardware, but this is outdated thinking. In addition, the concepts behind working with multiple processors wasn’t well understood—developers could make mistakes that would actually decrease application performs. Finally, the resources for creating programs that could use multiple processors were somewhat rare, making the task nearly impossible. Today, none of these reasons are valid. Unless you’re creating a simple application that simply won’t benefit from using multiple processors, you really should consider adding this skill to your toolbox.

One problem does remain. Many of the texts that provide the information needed to learn how to work with multiple processors are written in language that the average human doesn’t understand. With C# 2008 and 2005 Threaded Programming this problem is also relieved. Learning how to work with multiple processors still isn’t a walk in the park, but it’s significantly easier thanks to this book.

What is it all about?

This book begins with a look at the hardware (to an extent), which may not seem very interesting at first. However, it would be a mistake to avoid that first chapter because the author does an excellent job of describing why things work the way they do. The first chapter answers a question that many books don’t: it tells you why parallel processing doesn’t often work the way you think it should and then it tells you how to overcome those problems. The author focuses on changing thought processes at the outset and modifying the way you look at code. These techniques are essential to obtaining the desired result. So, take my advice: don’t skip the first chapter even if you’re sorely tempted to do so.

The second chapter moves on to the operating system. This is also the first chapter where the author presents any significant code. I tried copying one of the examples directly from the book and didn’t get it to work. Sometimes it’s hard to get an example to work if you type it in from the book because the author may forget to tell you some little something you need to get the example to run. So, I downloaded the source code from the publisher’s Web site and tried again. This time the example worked. The author does a fantastic job of relating the operating system material back to the first chapter. I also appreciated the use of Process Explorer as a teaching tool in this chapter. You really do get a good feeling about how things are supposed to work.

Starting with Chapter 3, you begin working through the principles of creating a parallel processing application in C#. Chapter 3 specifically talks about using a BackgroundWorker component. The author could have probably chosen a different example in this chapter. The example shows how to break a code using the brute force method—not an especially helpful example for a computer book, especially with the security issues companies are fighting today. That said, I think the example is mainly supposed to be a tongue-in-cheek joke. The example is still useful in teaching the principles of parallel processing.

Chapter 3 also introduces a quiz at the end of the chapter. The author includes the answers immediately after the quiz, so the questions are of limited value to a teacher. It would have been better to see the answers in an appendix or perhaps in a teacher’s guide. Even so, the questions are helpful because they emphasize important points in the chapter.

The book continues with threads in Chapter 4, where you discover the SMS Encryption Engine example. Chapter 5 moves on to debugging techniques. When you get to Chapter 6, you realize that you’re no longer talking basics. Chapter 6 begins the process of looking at viewing multithreading through the eyes of a designer. In this case, you’re examining thread control using patterns. The example in this chapter is particularly nice—it focuses on a situation where the reader is writing an application for NASA. The chapters continue step-by-step until by Chapter 12, you’re building a completely parallelized application. I wish I had space to provide a complete description of each chapter, but you’ll really want to explore this book on your own.

Perfection of Execution

Many of the books I read today have screenshots that are nearly impossible to see. The text and details in them are too small to read and I end up wondering why the author even bothered to include them since they aren’t that valuable to me as a reader. Some of the text in the screenshots in this book does get a bit small, but it’s all readable. The line art is well executed and extremely useful. The perfection of execution of these fit and finish issues gave me confidence that the material I was reading would work well, too.

The great artwork also extended to the examples. All of the examples appear quite professional and I have to wonder whether the graphics were professionally rendered and then used by the author. The author and the production staff obviously care deeply for their work—it definitely shows.

Getting the Code Files

The book contains a section called “Downloading the example code for this book.” It doesn’t work. The direct link won’t help you obtain one bit of the source code. Instead, you must go to the publisher’s Web site at http://www.packtpub.com/support, supply your e-mail address, and then wait for an e-mail to arrive. I found the process annoying to say the least. I later discovered that the URL is case sensitive, which was somehow even more annoying than going through all of the oddities of trying to obtain the code in the first place. If you want the source code for this book, go to:

http://www.packtpub.com/files/code/7108_Code.zip

The source code does require a little time to download at nearly 50 MB. Even with a DSL connection, I found myself waiting for a while. Part of the problem is that the source code file includes the compiled examples (all of which appear to run). I’m finding that most readers today would rather have a source code file that includes just the source code so that the download time is shorter. However, I don’t consider the inclusion of compiled source a major issue.

A Little About the Writing

I did find one recurring problem throughout the book and it’s not something that the author could avoid. Mr. Hillar obviously speaks a number of languages quite well—a skill I haven’t tackled and find admirable when I discover someone who does it well. However, as you go through the book, you can detect a slight accent in the writing. The text isn’t quite put together the way that someone in America would write. Consequently, I found myself reading some text multiple times to understand what the author is trying to say. I feel the author has done an outstanding job, so it’s worthwhile taking a little extra time getting around a little bit of an accent in his prose.

There were also a few bits of text that I found quite humorous, but a colleague couldn’t understand. For example, the author includes a section in many of the chapters called, “Have a go hero” that I found hysterical. Then again, I also get English humor. It’s a good idea to accept the author’s tongue-in-cheek humor as it was meant—to entertain. Personally, I give Mr. Hillar two thumbs up for putting a bit of humor in an otherwise horribly dull topic. I’ve also been on the receiving end of this particular problem—some people in other countries don’t get my humor either.

Is this a good book?

Sometimes the definition of an expert is someone who makes it look all too simple. That’s what the author does in this book. You’ll find yourself saying repeatedly that a particular technique seems too simple. Then you’ll try the technique and find that it really does work as advertised. A book really can’t do much more for the reader than that.

I loved the word pictures this author uses for examples. For example, he used a word picture of a high-speed printer and the person feeding it to illustrate what happens in the hardware. I doubt very much anyone has used word pictures in that way for this topic before. Even if you don’t understand hardware, the word pictures get the point across to you in a way that most people can understand without a lot of thought.

BIO

John Mueller is a freelance author and technical editor. He has writing in his blood, having produced 82 books and over 300 articles to date. The topics range from networking to artificial intelligence and from database management to heads down programming. His current project is LINQ for Dummies (available now), which you can order at http://www.amazon.com/exec/obidos/ASIN/0470277947/datacservip0f-20/. His technical editing skills have helped over 60 authors refine the content of their manuscripts. You can reach John on the Internet at JMueller@mwt.net and his Web site at: http://www.mwt.net/~jmueller/.

 


Discuss Book Review: C# 2008 and 2005 Threaded Programming
 
I liked this review overall but I found a few things that made me question it's...
Thank you very much for your insights :). I'm always looking to improve my...
John, I've posted a link to your review from my (rather more harsh) one on the...
Hi Jon, Thanks for linking to my review; that's fine with me. I always consider...
>>> Post your comment now!
 

 
 
>>> More ASP and .Net Coding Techniques Articles          >>> More By John Mueller