Click here to Skip to main content
15,867,771 members
Articles / Programming Languages / Visual Basic
Article

.NET and COM: The Complete Interoperability Guide

Rate me:
Please Sign up or sign in to vote.
2.92/5 (12 votes)
24 May 20034 min read 76.1K   23   9
Book Review of .NET and COM: The Complete Interoperability Guide

This article is in the Book Review chapter. Reviews are intended to provide you with information on books - both paid and free - that others consider useful and of value to developers. Read a good programming book? Write a review!

.grade {font-size:7pt}
Title.NET and COM: The Complete Interoperability Guide
AuthorAdam Nathan
PublisherSams Publishing
PublishedJanuary 2002
ISBN067232170x
PriceUSD 59.99
Pages1578

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:

  • Background
  • 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
  • Appendices

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.

Grades:

Overall Value5
Accuracy5
Depth5
Readability4
Organization4
GradeA-

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+:100A :95A-:90B+:85B:75B-:70C+:65C :60C-:50D+:40D :30D-:25F :0

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior) erikwestermann.com
Canada Canada
Erik is a senior developer-writer with more than 20 years professional programming experience designing and developing large scale database and Internet-centric applications for organizations including MSN.ca, ADP, Nortel, EDS, Merrill Lynch, ePost, CIBC, TD Securities, IBC, CIHI, InnovaPost, etc.

Erik has been specializing in BizTalk Server-based solutions for many years. His experience includes many SOA and ESB-style applications using technologies like Commerce Server, SharePoint, ASP.NET and advanced .NET Framework.

Comments and Discussions

 
QuestionMessage Closed Pin
9-Mar-12 20:55
sangram3609-Mar-12 20:55 
QuestionStarting COM programming Pin
TheEagle17-May-06 3:51
TheEagle17-May-06 3:51 
GeneralPages Pin
Maximilian Hänel26-May-03 4:05
Maximilian Hänel26-May-03 4:05 
The book has actually 1608 pages OMG | :OMG: not 997 as you wrote on top of the article.
I was just wondering because you mention in the article that "NET and COM weights in at 1578 pages"...

cu

Max

"You can always improve your chances of writing
bug-free code by writing code that doesn't do anything"

Rob Macdonald, Serious ADO

GeneralRe: Pages Pin
Erik Westermann26-May-03 16:23
professionalErik Westermann26-May-03 16:23 
GeneralRe: Pages Pin
Maximilian Hänel27-May-03 12:58
Maximilian Hänel27-May-03 12:58 
GeneralRe: Pages Pin
Erik Westermann27-May-03 23:48
professionalErik Westermann27-May-03 23:48 
GeneralIncorrect Author Pin
Richard Birkby26-May-03 2:06
Richard Birkby26-May-03 2:06 
GeneralRe: Incorrect Author Pin
Roger Alsing26-May-03 2:56
Roger Alsing26-May-03 2:56 
GeneralRe: Incorrect Author Pin
Erik Westermann26-May-03 2:58
professionalErik Westermann26-May-03 2:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.