Addison-Wesley has pulled in one of Microsoft’s big hitters to help produce what looks to be a great addition to the serious .NET developer’s library. In Essential .NET, Volume 1, The Common Language Runtime, authors Don Box (an architect at Microsoft) and Chris Sells present the CLR in great detail. The book is a difficult read but will leave you with a solid understanding of the inner workings of the CLR.
Only the CLR
This book is part of Addison-Wesley’s Microsoft .NET Development Series, which is written by some of the top minds in the Microsoft technology arena. The series will also include a second volume that’s still in the works. Essential .NET is not designed to teach C# or the .NET Framework. Volume 1 provides a thorough explanation of the CLR, allowing developers to learn how to build better applications once they select their .NET-capable language and are familiar with the .NET Framework.
Everything a developer needs to understand about the CLR is in this volume, from the basics of modules and its metadata to security policies and memory management.
Author Don Box is well known in the computer community and has written numerous texts. His expertise sets his work apart. The only downside is that his writing is sometimes tough to follow (as he readily admits). But even though this book is hard to read, its content makes it worth reading from cover to cover.
The book is written without any specific language in mind, and Box tries to provide a language-neutral text, but you’ll find that many of the examples are in C#.
How does it stack up to other books?
Of course, other books about the CLR are available. But although they cover some of the same information, they do not provide the same details as Essential .NET. Among these books is Compiling for the .NET Common Language Runtime by John Gough, which looks at the CLR from a compiler perspective. Another book is .NET Common Language Runtime Unleashed by Kevin R. Burton. It’s written for a developer audience but appears to focus more on the .NET Framework as a whole rather than the nitty-gritty of the CLR.
What you can expect from the book
Essential .NET consists of 10 chapters that explore the ins and outs of the CLR. To help the reader understand why the CLR was created, Box starts with a brief history of COM and its shortcomings, which led to the development of the CLR. The book describes how the CLR differs from COM and how it resolves COM limitations.
Essential .NET then goes on to describe the CLR in detail. It explains how CLR-based programs are translated into assemblies and what happens at load time. It discusses Common Type System (CTS). Since type names (structs, classes, etc.) are language specific, Box uses C# when describing how the types map to CLR type definitions. However, the CLR-level information is the same regardless of the language used.
The book discusses not only how the types map to the CLR, but also how the types behave at runtime. It then goes on to show the relationship between types, objects, and values and how they interact. Next, the text covers messages with respect to method calls, followed by a short chapter on AppDomain. The book ends with a discussion of the CLR security model and CLR externals. The CLR externals chapter explains what happens with memory management at runtime and how to load CLR-based code in a Win32 process.
Tough going, but useful
I can’t stress enough how difficult it is to get through this book. However, there is highly useful technical information worth pulling from the text, such as how type initialization works in the CLR, the life (and death) of an object, and techniques for avoiding performance hits—for example, the correct way to handle multiple pre- and post-processing on method calls. This information will ultimately help you build a more efficient application.
On the flip side, when errors arise, such as a memory or access errors, the knowledge acquired from Essential .NET will help you diagnose the problem faster. Just as machinists are more productive when they know how the machine functions, developers can create more productive code when they know how the CLR works. And machinists with knowledge of a machine can quickly zero in on problems and fix them. The same holds for developers of the .NET Framework.
If you can get past the difficult reading, Essential .NET, Volume 1, The Common Language Runtime is a good text to own. Just make sure to allocate a lot of reading time and several pots of coffee for the job.