C/C++ Users Journal January, 2005

Programmer's Book Review

By Peter Roth

Peter Roth is the president of Engineering Objects International, producers of commercial and custom C# components. Peter can be contacted at http://www.engineeringobjects.com/ and peternroth@yahoo.com.

Programming Microsoft .NET
Jeff Prosise
Microsoft Press, 2002
816 pp., $60.00
ISBN 0735613761

Applied Microsoft .NET Framework Programming
Jeffrey Richter
Microsoft Press, 2002
640 pp., $50.00
ISBN 0735614229

Granted the books reviewed here have a two-year-old copyright date, and two years is a long ways away from the bleeding edge. It's not news, therefore, that .NET is Microsoft's new "platform." The time lag is okay by me. I have just about finished my ongoing projects doing things The Old Way. At this stage of my development, picking up .NET is like visiting a huge country where they speak in foreign tongues—C#, VB.NET, and J#, and where the word "assembly" takes on a new meaning. I've been using Microsoft's Visual Studio 2003 to explore .NET, and I've downloaded the free Express versions of the Microsoft development products for C#, VB.NET, and Visual Web Developer [1]. I like these Beta release tools and recommend them as an easy .NET starting point.

Microsoft typically says something in its promotional material like "if you use .NET, you will write 50 percent less code." It seems true. .NET replaces all but four of my 31 well-used utility functions. The unstated problem with this idea is that you don't know which half of your code you don't have to write! Therefore, you have to study the entire Framework. As an entry to .NET, I turned to these two books by well-known authors.

The contents of Programming Microsoft .NET, by Jeff Prosise, are splendid. Focusing primarily on ASP.NET (the successor to Microsoft's ASP), Prosise introduces and clearly explains the topics that need learning, along with sufficient detail to build one's own solutions: Web Forms, Web Controls, User Controls, Custom Controls, Web Applications, and Security. There is a lot of idiomatic C# code all nicely formatted, clearly written, and well thought out. Clean. Copy it from the CD to play with it.

The examples are superb. I counted five "Hello, World" programs, and two "calculate 2+2" programs. These programs keep the calculation simple enough so that one can focus on all the other code you have to write to get those pages to work.

Prosise got silly in the "Introduction," opening with, "Yes it's that time again—time to throw away everything you know and start all over." C'mon editors! We know what's right, what's wrong, what works, and what doesn't. We're obviously not going to toss our brains out the Windows!

Sad to say, the format of the book is a cheat. Microsoft Press used Ultra Thick Pages and Generous Margins. Most modern computer books of this thickness are 1.5K pages, so I'm out 700 pages of material and I lose shelf space for another text of reasonable size. One could argue this is a rip-off. Even so, the beauty of the writing makes this book worth reading, and it's one of the best books I've read in a while.

Whereas Prosise's book is beautiful but obese, Jeffrey Richter's Applied Microsoft .NET Framework Programming is irritating and fat. The stated goal is "to explain how to develop applications for the .NET Framework." My guess at the target audience might (and that's a tentative might) include compiler developers who are already well versed in .NET. The average reader (me) finds this an eclectic and disjointed read, and a poor place to start exploring .NET.

Beginning with "Basics Of The Framework," the text is supposedly an overview, but within a few pages, we're into the bowels of the Common Language Runtime (CLR), and reading about protecting our intellectual property and interoperating with unmanaged code. This is not an overview—it's the steam tunnels. The rest of the book addresses the .NET Type System, but topics are addressed in an order that seems counter-intuitive.

When I first picked this volume up at the booksellers, the example code looked enough like C# that I was interested. There was also a lot of "other code," which turned out to be Intermediate Language (IL). .NET requires that all compilers produce IL, so I thought it could be interesting to see what the Microsoft C# compiler produces, but there is Entirely Too Much IL. Enough, already! I want to read man-generated C#. Let the machine read the machine-generated IL.

Speaking of C#, Richter uses C#, sort of. That is, the Types in the text's code are those of the CLR rather than the idiomatic types of C#; for example, the CLR type Int32 is used in all code rather than the idiomatic C# int. The code is readable, but it looks weird.

There's a 50-page treatise on the Automatic Memory Management (Garbage Collection) system, which provokes the average reader to wonder, "If it's automatic, why do I need to read 50 pages?"

The biggest irritant is Richter's running critique of .NET, in which he complains that Microsoft has done it wrong, so the reader wastes time wading through both the critique and the presentation of irrelevancies. The text needed, but didn't receive, severe editing. It reads as if the original proposal is part of the manuscript. Other parts look like Richter was playing around with stuff, but it's not clear why a reader should be interested in the experiments. And there are entirely too many forward references.

Like the Prosise book, this one also cheats on size: Ultra Thick Pages, Generous Margins. Argh! The last time I looked, this text had 4 and 1/2 stars at Amazon.com, but I would rate it at most a third of that.

References

[1] http://lab.msdn.microsoft.com/express/visualc/.