|
|
|
ATL
The Active Template Library was designed from the ground up to make developing COM objects in C++ easy and flexible. ATL is fairly minimal, which is its greatest strength. (The original version of the ATL shipped as four C++ header files, one of which was empty!) Using ATL, you can build fairly small, self-contained binaries without requiring any additional runtime DLLs. ATL is representative of the movement away from monolithic, single-tier applications and serves as a good substrate for developing the lightweight COM components required for modern distributed applications. ATL is less of a massive, MFC-like infrastructure than it is a modular, time-saving library that keeps thousands of programmers from implementing IUnknown and IClassFactory over and over again. ATL does not try to be all things to all people. Version 1 provides very reasonable support for implementing IUnknown, IClassFactory, IDispatch, IConnectionPointContainer, and COM enumeration. Version 2 offers enhanced versions of the original ATL classes in addition to support for writing ActiveX™ controls. ATL does not provide collections and strings (ATL assumes you will use the Standard C++ Library classes for these); ODBC support (the world is moving to COM-based data access that doesn't need wrapping); WinSock wrappers (sockets are so five-minutes-ago); or a complete wrapper for the Win32® API (ATL 2.0's control implementation provides support for implementing dialogs and WndProcs). Also missing from ATL is MFC's document/view model. Instead, ATL assumes that you will use the more scalable and flexible COM approach of connectable outbound COM interfaces (ActiveX controls, for instance) to notify the UI-based objects. The key idea is to use the right tool for the job. If you are building nonvisual COM components, then ATL is likely to be a much better choice than MFC in terms of development effort, scalability, runtime performance, and executable size. For modern user interfaces based on ActiveX controls, ATL also produces smaller and faster code than MFC. On the other hand, ATL requires more COM knowledge than is needed to operate MFC's Class Wizard. For building double-clickable single-tier applications, ATL is currently no more helpful than the Standard Template Library (STL). For this, MFC remains the superior choice. The design of ATL is highly inspired by STL, which has become part of the Standard C++ Library included with all ANSI/ISO-compliant C++ compilers. Like STL, ATL uses C++ templates aggressively. Templates are one of the more controversial features in C++. When abused, templates can lead to bloated executables, poor performance, and unintelligible code. Used judiciously, templates provide a degree of generality combined with type-safety that is impossible to achieve otherwise.
|
|