The .NET Framework SDK and Visual Studio .NET make it easy to use legacy COM components from .NET-based code (also referred to as managed code). The Framework does a lot of work for you by abstracting the differences between the unmanaged world of COM and the managed world of .NET through interception. Interception occurs in a piece of code referred to as the Runtime-Callable Wrapper (RCW) whose role is to seamlessly integrate the .NET and COM worlds so that they can peacefully coexist. For example, COM components report an error using a special return value that is an HRESULT data type. Your managed (.NET-based) application errors to be reported as exceptions and is unaware of the HRESULT data type. The RCW converts failure-related HRESULTs codes (codes other than the S_OK success code and user-defined HRESULTs) into equivalent .NET exceptions providing a programming model that's consistent with the rest of the .NET programming environment. When a COM component returns a user-defined HRESULT, the RCW maps it into a System.Runtime.InteropServices.COMException and stores the HRESULT value in the exception's ErrorCode property - again providing .NET applications with a consistent programming model that makes it easy to detect and respond to error conditions.
That's only a very small part of the .NET and COM interoperability story - this book covers the rest of it in great detail in an engaging way that brings some kick to a perhaps seemingly boring topic. Among the engaging aspects of this book are the "Digging Deeper", "Tip", and other notes that sprinkled throughout which provide valuable insights to the discussion at hand.
.NET and COM weighs in at 1578 pages with about 1245 pages of content, 250 pages of appendices, and 81 pages taking up the comprehensive index (all page counts are approximate since the book includes separator pages between sections and chapters). The book's content is packed with practical information in the form of guidance and detailed information right from the first page. However, the sheer density of the information makes it easy to miss important points such as the author's recommendations on how to version .NET components (assemblies) to make it easy for COM-based clients to use them in the unmanaged world.
The book is divided into nine sections:
- Using COM Components in .NET Applications
- Using .NET components in COM Applications
- Designing Great .NET Components for COM Clients
- Designing Great COM Components for .NET Clients
- Platform Invocation Services
- Advanced Topics
- Comprehensive Examples
Each section builds on it predecessors' but not all readers may agree with the organization. I personally would have preferred the Designing sections to appear before the Using sections since good design is essential to easy use. Although most readers will likely read the book in the order it's presented in, the book is organized to make it easy to hop around from section to section of interest without getting lost.
Although this is a great book, there are a couple of drawbacks:
Serviced components, also known as COM+ components, are given less than 10 pages of coverage throughout the book. Granted that COM+ sounds like it provides services only to COM components, it does play an important role in the managed world of .NET applications. In fact, COM+ is so important to .NET that there are an entire set of classes and attributes available in a dedicated namespace called System.EnterpriseServices. COM+ provides services that extend .NET applications' abilities over those provided by basic .NET.
The second drawback relates to how some important information gets disbursed throughout the entire book rather than just one place. For example, when you create a .NET component that will be used by COM clients, you have the option of using one of three attributes to expose the .NET component's interface to COM. The fist time this feature is mentioned is in chapter three on page 397 where, if you read to the end of the "FAQ" box, you'll see a reference to chapter 12 where more information on the topic appears on page 556. What's interesting is that one of the most critical points appears in one of two "Caution" notes making it difficult to see that there's something really important on the page. In addition, some more information appears, along with some of the text from chapter 12, much later in appendix A (on page 1257) with a reference back to chapter 12. All of these references and presentation styles work to dilute the importance of the information and effectively hide it from novice readers (those that are new to .NET, COM, or both).
Despite these few drawbacks, this is a great book for intermediate .NET developers that have some experience with COM can benefit from. The book's scope makes this book useful for developers that work on both COM-centric and .NET-centric environments.
Calculate the Grade as follows: Add all numeric grade values, divide by 25, multiply by 100, then assign the letter grade based on the following ranges:
|A+:100||A :95||A-:90||B+:85||B:75||B-:70||C+:65||C :60||C-:50||D+:40||D :30||D-:25||F :0|