2020ok  Directory of FREE Online Books and FREE eBooks

Free eBooks > Medicine > Allied Health Professions > Medical Technology > Essential COM

Essential COM

by Don Box


Download Book
(Respecting the intellectual property of others is utmost important to us, we make every effort to make sure we only link to legitimate sites, such as those sites owned by authors and publishers. If you have any questions about these links, please contact us.)


link 1



About Book

Amazon.com
The Component Object Model (COM) is deep and extremely difficult, making it impossible to grasp the ideas behind this specification quickly or easily. Don Box, the author of Essential COM concedes that it took him six months of reading documentation, writing programs, and experiencing general puzzlement before he had his personal COM epiphany. Nonetheless, if you're a C++ programmer and you want your skills to continue to be relevant in a PC market dominated by Windows 95 and Windows NT, you need to get going down the path toward your own COM enlightenment. COM is the tool of choice for creating distributed and concurrent systems for modern Microsoft operating systems. If there's a book that will help you get a handle on the COM phenomenon, Essential COM is it.

Endorsed by object-orientation guru Grady Booch and Microsoft COM expert Charlie Kindel, Box's book takes the reader from an elucidating discussion of why a demand exists for COM and how it fits into the progression of C++ technology to a cool exhibition of some COM programs he's written. Along the way, Box covers the four corners of COM interfaces, classes, apartments, and security--all explained in developer's detail. He also gives attention to access control, marshaling, and Distributed COM (DCOM). Essential COM isn't an application programming interface (API) reference; it is an exploration of the Tao of COM. As the author says in his preface, you will figure out the how of COM programming quickly, as soon as you grasp the why.

Dr. Dobb's Journal
Read the entire review of this book.

Starting from the progressive definition of an informal set of requirements for modular software architectures, the first chapter of Essential COM highlights how, by itself, the C++ language is not capable of satisfying many of them, even when associated with DLLs. Several possible design alternatives are then evaluated, and the final decision leads to the rough engineering of COM. This is perhaps the most vaporware-free introduction to the subject I have ever read because it explains through facts and not conjecture how and why the C++ object model maps well to COM... As the book proceeds, more and more room is given to complex technical issues and useful (while not trivial) COM programming idioms, such as tear-off interfaces for saving memory as the number of interfaces climbs significantly but not all of them happen to be constantly in use. In all cases the solutions make use of only the raw COM API and interfaces at the C++ level. Neither the theory, nor any of the numerous code snippets sprinkled throughout in the book, mention high-level frameworks such as ATL or MFC. The dissertation on multithreading issues and marshaling are very detailed and betray the vast experience of the author in the implementation of nontrivial COM systems. --Davide Marcato, Dr. Dobb's Journal

Book Description

Written by a leading COM authority, this unique book reveals the essence of COM, helping developers to truly understand the why, not just the how, of COM. Understanding the motivation for the design of COM and its distributed aspects is critical for developers who wish to go beyond simplistic applications of COM and become truly effective COM programmers, and to stay current with extensions, such as Microsoft Transaction Server and COM+. Box examines COM from the perspective of a C++ developer, offering a familiar frame of reference to ease you into the topic.



Book Info
Examines COM from the perspective of a C++ developer, offering a familiar frame of reference to ease into the topic. Written by a leading COM authority. Paper. DLC: Object-oriented programming (Computer science)

From the Inside Flap

My work is done.

I can finally rest, knowing that I have finally put into writing what many have termed the rich oral history of COM. This book reflects the evolution of my own understanding of this rogue technology that Microsoft was kind enough to reveal to the programming world in 1993. While I did not attend the original OLE Professional Developer's Conference, I still feel as if I have been doing COM forever. After almost four years of working with COM, I can barely remember the pre-COM era of computing. I can, however, vividly remember my own painful trek across the COM landscape in early 1994.

It took me roughly six months before I felt I understood anything about COM. During this initial six-month period of working with COM, I could successfully write COM programs and almost explain why they worked. However, I had no organic understanding of why the COM programming model was the way it was. Fortunately, one day (August 8, 1994, roughly six months after buying the book Inside OLE2), I had an intense epiphany and at once COM seemed obvious to me. This by no means meant that I understood every COM interface and API function, but rather, that I understood the primary motivating factors behind COM. From this, it became clear how to apply the programming model to everyday programming problems. Many other developers have related similar experiences to me. As I write this preface three Augusts after the fact, developers still must go through this six-month waiting period prior to becoming productive members of COM society. I would like to think that this book might shorten that time period, but I make no promises.

As this book emphasizes, COM is more a programming discipline than a technology. To this end, I have attempted to not bludgeon the reader with detailed descriptions of each parameter to each method from each interface. Rather, I have tried to distill the essence of what COM is really about, leaving the SDK documentation to fill in the gaps left behind by each chapter. Wherever possible, I have attempted to address the underlying tensions that motivate a particular aspect of COM rather than provide detailed examples of how to apply each interface and API function to a contrived example program. My own experience has shown that once the why is understood, the how follows fairly naturally. Conversely, simply knowing the how rarely provides adequate insight to extrapolate beyond the documentation. This insight is critical if one hopes to keep up with the programming model's continual evolution.

COM is an extremely flexible substrate for building distributed object-oriented systems. To take advantage of COM's flexibility, one must often think outside the constraints of the SDK documentation, articles or books. My personal recommendation is to assume that anything you read (including this book) may be incorrect or woefully out of date and instead form your own personal understanding of the programming model. The surest way to understand the programming model is to focus on mastering the basic vocabulary of COM. This can only be accomplished through writing COM programs and analyzing why those programs work the way they work. Reading books, articles and documentation can help, but ultimately, dedicating the time to contemplate the four core concepts of COM (interfaces, classes, apartments and security) can only enhance your effectiveness as a COM developer.

To help the reader focus on these core concepts, I have tried to include as much code as possible without explicitly providing elaborate implementations for the reader to simply copy into their own source code. To ensure that COM programming techniques are also presented in context, Appendix B contains one complete COM application that is an example of many of the concepts discussed throughout the book. Additionally, Appendix B contains a library of COM utility code that I have found useful in my own development. Some parts of this library are discussed in the book in detail, but the entire library is included as a demonstration of how to architect de facto C++ implementations. Also note that much of the code that appears in each chapter uses the C runtime library macro assert to emphasize that certain pre- or post-conditions must be met. In production code, many of these assert statements should be replaced with somewhat more forgiving error handling code.

One downside of published books is that they are often obsolete by the time they arrive at the local bookstore. This book is no different. In particular, the pending release of COM+ and Windows NT 5.0 will certainly render various aspects of this book incorrect or at least incomplete. I have tried to anticipate the evolution of the model imposed by the release of Windows NT 5.0, however, at the time of this writing, Windows NT 5.0 has not yet entered its public beta cycle and all information is subject to change. COM+ promises to evolve the model even further, however, it was impossible to include COM+ coverage and still deliver my manuscript this year. I highly encourage you to investigate both Windows NT 5.0 and COM+ when they become available.

One rather painful decision I had to make was how to address the various commercial libraries used to implement COM components in C++. After observing the common questions that appear on various Internet newsgroups, I elected to ignore ATL (and MFC) and instead focus on the bread-and-butter topics of COM that every developer must master irrespective of the library used. More and more developers are generating ATL spaghetti and wondering why things don't work. I firmly believe one cannot learn COM by programming in ATL or MFC. This does not mean that ATL and MFC are not useful tools for developing COM components. It simply means that they are not suited to demonstrating or learning COM programming concepts and techniques. This makes ATL inappropriate for a book focused on the COM programming model. Fortunately, most developers find that once COM is understood, the basics of ATL can be mastered in short order.

Finally, the quotes that begin each chapter are a chance for me to write whatever I felt like for a small section of the book. In an effort to keep my writing as direct as possible, I restricted my wild off-topic stories to no more than 15 lines of C++ code per chapter. Usually, the code/quote represents the pre-COM approach to a problem or concept presented in the chapter. I leave it as an exercise for the reader to deconstruct my state of mind when writing a particular chapter based on these hints. Acknowledgements

Writing a book is incredibly hard, at least it was for me. Two people who I know for certain suffered more than I did were my patient wife Barbara and my tolerant son Max (who prefers COM to other object models despite his youth). To both of you, thanks for tolerating my absence and generally cranky disposition while I tried to write. Fortunately, my freshly-instantiated daughter Evan was born after the bulk of this book was written and has had a fairly present and pleasant father. A related thanks goes out to all the staffers at DevelopMentor who had to cover for me when I "went dark" to crank out chapters.

A lot of my early thinking about distributed systems was formed working for Tatsuya Suda at UC Irvine in the early 1990's. Tatsuya taught me how to write, how to read, and how to deal with unruly train passengers in Tokyo. Thanks and sorry.

Thanks to my old office-mate Doug Schmidt for introducing me to Stan Lippman at the C++ Report. Despite Stan's rousing rejection of my first article, I first got my name in lights thanks to you two. Thanks to Mike Hendrickson and Alan Feuer at Addison Wesley for getting this project started. Thanks to Ben Ryan and John Waite for being patient. Thanks to the folks at Microsoft Systems Journal who tolerated my late submissions during the production of this book. In particular, thanks to Joanne Steinhart, Gretchen Bilson, Dave Edson, Joe Flanigen, Eric Maffei, Michael Longacre, Joshua Trupin, Laura Euler, and Joan Levinson. I promise never to be late again.

Thanks to David Chappell for writing the finest book on COM available. I heartily recommend that everyone buy a copy and read it at least twice. Thanks to the CORBA and Java partisans and zealots who have engaged me in flame-wars on various Usenet newsgroups over the years. Your constant vigilance has made my own understanding of COM infinitely better. Despite the fact that I still feel many of your arguments are specious and somewhat Martian, I respect your desire to survive.

Several people at Microsoft proper have been very helpful to me over the years and either directly or indirectly helped me write this book. Sara Williams was the first COM person from Microsoft I had ever met. Right after explaining that she didn't know Bill all that well, she introduced me to Gretchen Bilson and Eric Maffei at Microsoft Systems Journal as consolation. Sara has always been a great "Box Evangelist" within the big house and I am forever grateful. Charlie Kindel wrote the nice forward to my book despite his heavy schedule and exceedingly regular tri

From the Back Cover

"Don Box makes it possible for mere mortals to join the COM cognoscenti. If youire a C++ COM programmer, buy this book." -David Chappell, Principal, Chappell & Associates and author of  Understanding ActiveX and OLE

Written by a leading COM authority, this unique book reveals the essence of COM, helping developers to truly understand the why, not just the how, of COM. Understanding the motivation for the design of COM and its distributed aspects is critical for developers who wish to go beyond simplistic applications of COM and become truly effective COM programmers. As the COM programming model continues to evolve, such insight also becomes essential to remaining current with extensions, such as Microsoft Transaction Server and COM+. By showing you why Distributed COM works as it does, Don Box enables you to apply the model creatively and effectively to everyday programming problems.

This book examines COM from the perspective of a C++ developer, offering a familiar frame of reference to ease you into the topic. You will also find comprehensive coverage of the core concepts of Distributed COM (interfaces, classes, apartments, and applications), including detailed descriptions of COM theory, the C++ language mapping, COM IDL (Interface Definition Language), the remoting architecture, IUnknown, monikers, threads, marshalers, security, and more. In addition, the book offers a thorough explanation of COMis basic vocabulary, provides a complete Distributed COM application to illustrate programming techniques, and includes the authoris tested library of COM utility code.



0201634465B04062001



About the Author

Don Box is a leading educator, recognized authority on the Component Object Model (COM), coauthor of the Simple Object Access Protocol (SOAP) specification, and coiner of the term "COM is Love." He recently joined Microsoft as an architect in the Microsoft® .NET Developer and Platform Evangelism Group.

Earlier in his career, Box cofounded DevelopMentor Inc., a component software think tank aimed at educating developers on the use of the COM, Java, and XML. A popular public speaker, Box is known for engaging audiences around the world, combining deep technical insight with often outrageous stunts.



0201634465AB06132002

Excerpt. © Reprinted by permission. All rights reserved.

My work is done.

I can finally rest, knowing that I have finally put into writing what many have termed the rich oral history of COM. This book reflects the evolution of my own understanding of this rogue technology that Microsoft was kind enough to reveal to the programming world in 1993. While I did not attend the original OLE Professional Developer's Conference, I still feel as if I have been doing COM forever. After almost four years of working with COM, I can barely remember the pre-COM era of computing. I can, however, vividly remember my own painful trek across the COM landscape in early 1994.

It took me roughly six months before I felt I understood anything about COM. During this initial six-month period of working with COM, I could successfully write COM programs and almost explain why they worked. However, I had no organic understanding of why the COM programming model was the way it was. Fortunately, one day (August 8, 1994, roughly six months after buying the book Inside OLE2), I had an intense epiphany and at once COM seemed obvious to me. This by no means meant that I understood every COM interface and API function, but rather, that I understood the primary motivating factors behind COM. From this, it became clear how to apply the programming model to everyday programming problems. Many other developers have related similar experiences to me. As I write this preface three Augusts after the fact, developers still must go through this six-month waiting period prior to becoming productive members of COM society. I would like to think that this book might shorten that time period, but I make no promises.

As this book emphasizes, COM is more a programming discipline than a technology. To this end, I have attempted to not bludgeon the reader with detailed descriptions of each parameter to each method from each interface. Rather, I have tried to distill the essence of what COM is really about, leaving the SDK documentation to fill in the gaps left behind by each chapter. Wherever possible, I have attempted to address the underlying tensions that motivate a particular aspect of COM rather than provide detailed examples of how to apply each interface and API function to a contrived example program. My own experience has shown that once the why is understood, the how follows fairly naturally. Conversely, simply knowing the how rarely provides adequate insight to extrapolate beyond the documentation. This insight is critical if one hopes to keep up with the programming model's continual evolution.

COM is an extremely flexible substrate for building distributed object-oriented systems. To take advantage of COM's flexibility, one must often think outside the constraints of the SDK documentation, articles or books. My personal recommendation is to assume that anything you read (including this book) may be incorrect or woefully out of date and instead form your own personal understanding of the programming model. The surest way to understand the programming model is to focus on mastering the basic vocabulary of COM. This can only be accomplished through writing COM programs and analyzing why those programs work the way they work. Reading books, articles and documentation can help, but ultimately, dedicating the time to contemplate the four core concepts of COM (interfaces, classes, apartments and security) can only enhance your effectiveness as a COM developer.

To help the reader focus on these core concepts, I have tried to include as much code as possible without explicitly providing elaborate implementations for the reader to simply copy into their own source code. To ensure that COM programming techniques are also presented in context, Appendix B contains one complete COM application that is an example of many of the concepts discussed throughout the book. Additionally, Appendix B contains a library of COM utility code that I have found useful in my own development. Some parts of this library are discussed in the book in detail, but the entire library is included as a demonstration of how to architect de facto C++ implementations. Also note that much of the code that appears in each chapter uses the C runtime library macro assert to emphasize that certain pre- or post-conditions must be met. In production code, many of these assert statements should be replaced with somewhat more forgiving error handling code.

One downside of published books is that they are often obsolete by the time they arrive at the local bookstore. This book is no different. In particular, the pending release of COM+ and Windows NT 5.0 will certainly render various aspects of this book incorrect or at least incomplete. I have tried to anticipate the evolution of the model imposed by the release of Windows NT 5.0, however, at the time of this writing, Windows NT 5.0 has not yet entered its public beta cycle and all information is subject to change. COM+ promises to evolve the model even further, however, it was impossible to include COM+ coverage and still deliver my manuscript this year. I highly encourage you to investigate both Windows NT 5.0 and COM+ when they become available.

One rather painful decision I had to make was how to address the various commercial libraries used to implement COM components in C++. After observing the common questions that appear on various Internet newsgroups, I elected to ignore ATL (and MFC) and instead focus on the bread-and-butter topics of COM that every developer must master irrespective of the library used. More and more developers are generating ATL spaghetti and wondering why things don't work. I firmly believe one cannot learn COM by programming in ATL or MFC. This does not mean that ATL and MFC are not useful tools for developing COM components. It simply means that they are not suited to demonstrating or learning COM programming concepts and techniques. This makes ATL inappropriate for a book focused on the COM programming model. Fortunately, most developers find that once COM is understood, the basics of ATL can be mastered in short order.

Finally, the quotes that begin each chapter are a chance for me to write whatever I felt like for a small section of the book. In an effort to keep my writing as direct as possible, I restricted my wild off-topic stories to no more than 15 lines of C++ code per chapter. Usually, the code/quote represents the pre-COM approach to a problem or concept presented in the chapter. I leave it as an exercise for the reader to deconstruct my state of mind when writing a particular chapter based on these hints.

Acknowledgements

Writing a book is incredibly hard, at least it was for me. Two people who I know for certain suffered more than I did were my patient wife Barbara and my tolerant son Max (who prefers COM to other object models despite his youth). To both of you, thanks for tolerating my absence and generally cranky disposition while I tried to write. Fortunately, my freshly-instantiated daughter Evan was born after the bulk of this book was written and has had a fairly present and pleasant father. A related thanks goes out to all the staffers at DevelopMentor who had to cover for me when I "went dark" to crank out chapters.

A lot of my early thinking about distributed systems was formed working for Tatsuya Suda at UC Irvine in the early 1990's. Tatsuya taught me how to write, how to read, and how to deal with unruly train passengers in Tokyo. Thanks and sorry.

Thanks to my old office-mate Doug Schmidt for introducing me to Stan Lippman at the C++ Report. Despite Stan's rousing rejection of my first article, I first got my name in lights thanks to you two. Thanks to Mike Hendrickson and Alan Feuer at Addison Wesley for getting this project started. Thanks to Ben Ryan and John Waite for being patient. Thanks to the folks at Microsoft Systems Journal who tolerated my late submissions during the production of this book. In particular, thanks to Joanne Steinhart, Gretchen Bilson, Dave Edson, Joe Flanigen, Eric Maffei, Michael Longacre, Joshua Trupin, Laura Euler, and Joan Levinson. I promise never to be late again.

Thanks to David Chappell for writing the finest book on COM available. I heartily recommend that everyone buy a copy and read it at least twice. Thanks to the CORBA and Java partisans and zealots who have engaged me in flame-wars on various Usenet newsgroups over the years. Your constant vigilance has made my own understanding of COM infinitely better. Despite the fact that I still feel many of your arguments are specious and somewhat Martian, I respect your desire to survive.

Several people at Microsoft proper have been very helpful to me over the years and either directly or indirectly helped me write this book. Sara Williams was the first COM person from Microsoft I had ever met. Right after explaining that she didn't know Bill all that well, she introduced me to Gretchen Bilson and Eric Maffei at Microsoft Systems Journal as consolation. Sara has always been a great "Box Evangelist" within the big house and I am forever grateful. Charlie Kindel wrote the nice forward to my book despite his heavy schedule and exceedingly regular trips to the barber. Nat Brown was the first person to show me apartments and has irrevocably polluted my vocabulary with the word "schwing." Kraig Brockschmidt explained to me that one particular aspect of COM that looks incredibly elegant was actually a grotesque last-minute hack. Dave Reed introduced me to Viper and listens to my clams each time I visit Redmond. Pat Helland spent the entire week of TechEd 97 twisting my brain and forcing me to reexamine most of my basic assumptions about COM. Scott Robinson, Andreas Luther, Markus Horstmann, Mary Kirtland, Rebecca Norlander, and Greg Hope have been great at keeping me out of the dark. Ted Hase helped me spread the word. Rick Hill and Alex Armanasu did a great job watching my back on the technical front. Other Microsoft people who have influenced my work through their own include Tony Williams, Bob Atkinson, Craig Whittenberg, Crispin Goswell, Paul Leach, David Kays, Jim Springfield, Christian Beaumont...

Comments

SEND A COMMENT

PLEASE READ: All comments must be approved before appearing in the thread; time and space constraints prevent all comments from appearing. We will only approve comments that are directly related to the article, use appropriate language and are not attacking the comments of others.

Message (please, no HTML tags. Web addresses will be hyperlinked):

Related Free eBooks

Related Tags

DIGG This story   Save To Google   Save To Windows Live   Save To Del.icio.us   diigo it   Save To blinklist
Save To Furl   Save To Yahoo! My Web 2.0   Save To Blogmarks   Save To Shadows   Save To stumbleupon   Save To Reddit