ATL COM

Richard Grimes

Wrox

ISBN 1-86100-249-1


Reviewed Mar 25, 1999

Richard Grimes is a fairly proficient Win32 author. He wrote quite a few books on this topic and also articles for various Windows related publications. This book explores COM and the more recent ATL (Active Template Library). The ATL is a recent technology put forth by Microsoft to make COM programming easier. It is supported in Visual C++ 6.0 (but not the former versions).

ATL COM is a dense book, which doesn't come as a surprise since it states on its cover "Programmer's Reference". This book is not for COM beginners (I would rather recommend Understanding DCOM). Very intricate details are mentioned as soon as the first chapters, like the use of templates, multiple inheritance and how these interact with COM and the ATL.

Chapter 2 is a little more user oriented with its thorough descriptions of the various ATL wizards as shown in VC++ 6.0. However, at this point, the intimate knowledge of ATL is still lacking to the poor reader. I would recommend skipping this chapter for now and coming back to it once you have read the book. Many of the things explained in there will make more sense to you then.

One thing stands out of the reading of this chapter, though : Visual C++ 6.0 is an extremely impressive piece of software and it does an excellent job at alleviating the burden of the programmer when it comes to manipulating files. You no longer have to navigate through the .cpp, .h and .idl file. Just invoke the right wizard and all the depending files will be updated accordingly (note that MIDL support from within the IDE is a feature that didn't exist in Visual C++ 5.0).

Chapter 4 is a very important chapter since it explains vital notions like the IDispatch interface and Type Libraries. You should make sure you understand the notions explained in this chapter before venturing further.

The following chapters are more oriented towards the GUI and explain how to use Windows and Controls with COM.

Starting at page 140 (out of 350) are appendices. Basically, this means that the first 140 pages contain the flesh of COM. The first Appendix explains COM maps. Basically, maps are how you associate COM concepts with actual C++ objects. There are many different maps and most of them will be automatically generated for you by the Wizards, but it is still a good idea to know what these maps actually do when you have to debug your application.

Appendices D and E explain the ATL and Object Wizards. These seem a little redundant with the VC++ documentation but it is actually quite handy to see these explained in different terms, given the complexity of the whole framework.

Appendix F describes some support classes offered by the ATL : Enumerators and Collections. I notice that the advent of the STL has somehow obsoleted some of these classes, explaining why some of them now exist in duplicates : the old one and the STL-compatible one.

More vital concepts are explained in Appendix G, and I really wonder why the author didn't get into those earlier. These are Aggregation and Class Factories. Aggregation is a vital part of COM and actually, since COM doesn't allow multiple inheritance of implementation, Aggregation is often the only way to solve certain classes of problems.

Another crucial concept in COM is multi-threading, and this is explained the Appendix H. Grimes does a good job at explaining the various available policies and explains some general tactics and how to choose from the various options (defensive code, thread pools, thread counting and also Connection Points in some way).

The other appendices list the various Windows and Control classes available in (or from) the ATL and also mentions Smart Pointers.

Overall a very informative book but much harder to read from cover to cover. This is much more a reference book than a user's book, unlike Understanding DCOM. Richard Grimes has an extremely strong knowledge of Win32's intricacies and this gets in the way of a clear understanding as the discussions sometimes venture in very tiny points of details. Don't let this be your first book on COM, but buy it once you have written a few COM programs and you wish to go beyond the flashy Wizard-driven generated-in-two-minute applications.

Cedric Beust


Back to the menu