Effective COM: 50 Ways to Improve Your COM and MTS-based Applications
Don Box, Keith Brown, Tim EwaldBooks.org participates in affiliate programs including Bookshop.org and the Amazon Services LLC Associates Program. We may earn a commission from qualifying purchases made through links on this page, at no additional cost to you.
Overview
With COM fully established as Microsoft's key middle-tier technology for object-oriented, distributed applications development, the lessons learned from numerous successful deployments have yielded important techniques and best practices for COM's most effective use. In Effective COM, the authors, Don Box, Keith Brown, Tim Ewald, and Chris Sells, offer 50 concrete guidelines for creating COM-based applications that are efficient, robust, and maintainable. Drawn from the authors' extensive practical experience working with and teaching COM, these rules of thumb, pitfalls to avoid, and experience-based pointers will enable you to become a more productive and successful COM programmer. The guidelines are presented within six major categories: the transition from C++ to COM; interfaces, the fundamental element of COM development; implementation issues; the unique concept of apartments; security; and transactions. Issues unique to the MTS programming model are also addressed in detail throughout the book. Sample pointers include: Define your interfaces before you define your classes (and do it in IDL). Design with distribution in mind. Dual interfaces are a hack. Don't require people to implement them. Don't access raw interface pointers across apartment boundaries. Avoid creating threads from an in-process server. Smart Interface Pointers add at least as much complexity as they remove. CoInitializeSecurity is your friend. Learn it, love it, call it. Use fine-grained authentication. Beware exposing object references from the middle of a transaction hierarchy. Don't rely on JIT activation for scalability. For each guideline, the authors present a succinct summary of the challenge at hand, extensive discussion of their rationale for the advice, and many compilable code examples. Readers will gain a deeper understanding of COM concepts, capabilities, and drawbacks, and the know-how to employ COM effectively for high-quality distributed application development. A supporting Web site, including source code, can be found at http://www.develop.com/effectivecom
This publication defines the best practices and reusability criteria of the Component Object Model (COM) for developers. The guidelines and best practices in this publication are intended to enhance the efficiency, reusability and reliability of applications utilizing COM and its distributed variant DCOM. This is not a COM tutorial, so you should already be familiar with the basics of COM, its interfaces and related technologies such as the Microsoft Transaction Server (MTS) and C++. This publication is intended for practicing developers who need a greater, more in-depth understanding of the relationships and the ramifications inherent in COM/ DCOM based development.
Synopsis
With COM fully established as Microsoft's key middle-tier technology for object-oriented, distributed applications development, the lessons learned from numerous successful deployments have yielded important techniques and best practices for COM's most effective use. In Effective COM, the authors, Don Box, Keith Brown, Tim Ewald, and Chris Sells, offer 50 concrete guidelines for creating COM-based applications that are efficient, robust, and maintainable. Drawn from the authors' extensive practical experience working with and teaching COM, these rules of thumb, pitfalls to avoid, and experience-based pointers will enable you to become a more productive and successful COM programmer. The guidelines are presented within six major categories: the transition from C++ to COM; interfaces, the fundamental element of COM development; implementation issues; the unique concept of apartments; security; and transactions. Issues unique to the MTS programming model are also addressed in detail throughout the book. Sample pointers include: Define your interfaces before you define your classes (and do it in IDL). Design with distribution in mind. Dual interfaces are a hack. Don't require people to implement them. Don't access raw interface pointers across apartment boundaries. Avoid creating threads from an in-process server. Smart Interface Pointers add at least as much complexity as they remove. CoInitializeSecurity is your friend. Learn it, love it, call it. Use fine-grained authentication. Beware exposing object references from the middle of a transaction hierarchy. Don't rely on JIT activation for scalability. For each guideline, the authors present a succinct summary of the challenge at hand, extensive discussion of their rationale for the advice, and many compilable code examples. Readers will gain a deeper understanding of COM concepts, capabilities, and drawbacks, and the know-how to employ COM effectively for high-quality distributed application development. A supporting Web site, including source code, can be found at http://www.develop.com/effectivecom
Booknews
COM is Microsoft's middle-tier technology for object-oriented, distributed applications development. Four authors from a COM education firm offer guidelines for creating COM-based applications based on their own practical experiences working with and teaching COM. The book is arranged in six chapters: the transition from C++ to COM; interfaces; implementation issues; apartments; security; and transactions. Its aim is to provide working developers of COM and MTS with solutions to common design and coding problems. Annotation c. by Book News, Inc., Portland, Or.
Editorials
Booknews
COM is Microsoft's middle-tier technology for object-oriented, distributed applications development. Four authors from a COM education firm offer guidelines for creating COM-based applications based on their own practical experiences working with and teaching COM. The book is arranged in six chapters: the transition from C++ to COM; interfaces; implementation issues; apartments; security; and transactions. Its aim is to provide working developers of COM and MTS with solutions to common design and coding problems. Annotation c. by Book News, Inc., Portland, Or.Davide Marcato
Beware (and Overcome) the Hidden Traps of COM/MTS Programming
It should be no secret to anyone that carrying out good (D)COM development is significantly more difficult than programming C++ and Windows applications the classic way. The game gets even more complicated when MTS (Microsoft Transaction Server) comes into play, with its additional burden of intricacies related to the rules and the constraints imposed by the transactional context. This complexity should not be ascribed to the intrinsic difficulty of some esoteric COM aspects; after all, most of them are shared by the other paradigms for distributed and component-based paradigms currently on the cutting edge of the technological wave, namely CORBA and (Enterprise) JavaBeans. The true reason why it all appears so prone to errors is the higher degree of discipline required to benefit from the positive aspects of the paradigm, both in terms of the thought on every design decision made and in the great care required during the coding phase (the latter gains particular importance if you work in C++). I find this necessary addition of thought in even the apparently innocuous and basic tasks beneficial in the long run to the mindset of many badly educated (or lazy, depending on the case) programmers and object-oriented design (OOD) specialists. The dark side of the medal is represented by the steep learning curve that keeps many from really getting familiar with the COM way of thinking and programming in short timeframes.
It is arguable that the tardiness showed by the industry in endorsing the COM message and investing in it has at least part of its motivations in the lack of explanatory and comprehensive documentation on the foundations (conceptual and implementative) of the model. Now that the primary hole has been more or less filled by a decent amount of quality literature, including most notably Essential COM, authored by one of the coauthors of this text and reviewed by DDJ's ERCB some months ago, many engineers in the industry are struggling to apply the newly digested paradigm to everyday software projects, often facing unexpected difficulties and uncertainties. The problem lies in the point I made earlier: Many developers have got in touch with COM/MTS and know its theory reasonably well, but they are stuck in the second part of the learning curve -- the one that extends from the theoretical knowledge up to the actual hands-on expertise, the one required to effectively build COM-based systems of nontrivial dimension.
The COM universe is so extremely vast and the paradigm shift so big that it is often very daunting to get acquainted and secure working with it, either as architectural designers or hardcore implementers.
When you find yourself in this situation, any reliable source of suggestions, proven guidelines, and exhaustive answers to recurring doubts would greatly help understand and overcome the many nontrivial issues. That's where Effective COM fits right in. The book can be thought of as a distilled dispenser of 50 rules-of-thumb and clearly explained guidelines stemming from the combined wisdom amassed by the four coauthors in many years of real-world experience and research.
The structure, not only the title, clearly resembles that of Scott Meyers's most excellent Effective C++. Each numbered rule is first stated and then explained and motivated, making frequent recourses to short and focused code snippets rigorously in pure C++, either to demonstrate the rule at work or to present the alternative solutions and drawbacks that made the authors opt for other possibilities. I have mixed feelings about whether this subdivision of the book in 50 seemingly independent aphorisms really fits this topic as well as it did for the C++ language in Meyers's case -- but it immensely helped the authors split what they had to say in short, manageable blocks. In this respect, the book is more digestible than its predecessor Essential COM, as one can blissfully read it in chunks of limited length, a few pages at a time, and even follow an order different from that proposed by the numeration.
The writing shows the same clean, direct style that characterized the aforementioned precursor. Considering the essential design shared by most Addison-Wesley texts of this type, with little or no graphical elements or screenshots and many copious pages of written text and short code fragments, the reader might at first get the impression of an overly academic manual. But as s/he proceeds with the reading, this sentiment quickly turns into appreciation for the directness of the concepts illustrated. When the topics get tough, the last thing you desire is a bunch of disturbing elements and side notes steering you away from the center of the analysis.
In conclusion, this is neither an introductory text, nor a tutorial. If your daily job is that of a manager, or if you are still familiarizing yourself with the COM, you'd better save the money for the moment. But if you are an experienced developer spending hours a day with COM/MTS and C++, or simply a COM programmer with much more theoretical knowledge than practical experience and strong intentions to avoid the typical errors and general misconceptions , you will do yourself a big favor purchasing a copy.--Dr. Dobb's Electronic Review of Computer Books