COM/DCOM & COM+ Qisheng Hong Yani Mulyani Paul Visokey Outline The Component Object Model - COM DCOM COM+ What is COM? Build software from parts, not from scratch A framework for creating and using components Both a specification and an implementation Makes software easier to write and reuse Provides widest choice in services, tools, languages, and applications Evolved from Object Linking and Embedding technology Foundation in OLE Version 2, 1995 Isn’t COM about “Objects”? No … COM sets out to solve system software problems that arise when hooking up randomly evolving combinations of binaries Benefits stem from its design an an integration and deployment architecture for software components Yes … from the perspective of these new kinds of objects, also called “components” COM is about clients communicating with objects COM based applications can be constructed using languageindependent components COM Architecture The Model The “ORB” The Services COM Fundamental Principles What the designers of COM were striving for... Binary components Any programming language Any location (in-process, cross-process, crossmachine) No centralized authority Object orientation Interoperability Reusability Simplest model possible Enable extensibility, maintainability and adaptability Multi-tier architecture The Component Object Model (COM) Components, Components, Components Code reuse and off-the-shelf components Language independent notion of an object Rigorous Encapsulation at the binary level Black box -- no leakage of implementation details All object manipulation through strict interfaces Polymorphism Define several different behaviors for a single object via multiple interfaces per class “Discoverable”: QueryInterface() IUnknown IDispatch COM Object IRobot The Component Object Model (COM) Standard API Binary structure for the interface between client and object Compilers support Microsoft’s COM binary structure - language independence The point of contact is the run-time binary representation OS acts as central registry for objects Applications only know the function of the object Wire-level standard for location transparency OOD and COM Table 1: Differences in design considerations between OOD and COM Differences in design considerations between OOD and COM Object-Oriented Design Assumptions Added COM Considerations Objects typically packaged in the same application (module) as client code Objects and clients typically in separate modules, both .EXEs and .DLLs Objects and clients run in a single process Objects and clients may run in different processes and on different machines Class (implementation) inheritance Interface inheritance (no implementation inheritance) Single interface per object (the object's class definition) Multiple interfaces per object Single client per object Multiple simultaneous clients per object 1:1 relationships between clients and objects typical Many:Many relationships between clients and objects is common The COM Object Request Broker The “model” is about how the technology is used The “ORB” is how it’s implemented Microsoft calls it the COM Runtime Secure Security is designed and built in. Not an option. Inherently Distributed Pluggable Security Transports Free! (Built-into Win32 Platforms) No separate client access license or expensive “developer” version Structure of the COM “ORB” Components and Applications The COM Runtime Core Services (Automation, Monikers, Storage, ComCat, Data Transfer, IR) COM and Distributed COM Registry MS-RPC Pluggable Security (SSPI) Pluggable Transports TCP UDP IPX SPX HTTP ETC. NTLM DCE Kerberos ETC. COM Runtime Architecture Flexible and extensible Pluggable Transports Proxy Other Component ORB TCP, UDP SPX,IPX Net BUI HTTP COM Runtime COM Client Server Machine COM Runtime Client Machine ORB Component COM Runtime Architecture Flexible and extensible Pluggable Security Providers Proxy Other Component ORB NTLM SSL, Certs. NT Kerberos DCE COM Runtime COM Client Server Machine COM Runtime Client Machine ORB Component COM Runtime Architecture Client COM run time Security provider COM run time Security provider RPC Inprocess Protocol stack LPC Component RPC Protocol stack Local DCOM networkprotocol Remote Accessing COM Services In the same process Fast, direct links to server library Client On the same machine Fast, secure lightweight RPC Secure, reliable and flexible DCE-RPC based DCOM protocol Client Process Client Client Machine Across machines Client Component Server Process COM Component Server Machine DCE COM RPC COM Component COM Limitations Lack of a common type system, each language involved in COM had its own type system. Architecture does not have perfect knowledge of the types. COM is hard to use. Reference counting, Microsoft IDL, Global Unique Identifiers (GUID), etc. require deep knowledge of COM specification from developers. COM is not robust enough for enterprise deployments. Services such as secure transactions, reliable communications, and load balancing are not integrated in COM. DCOM: Multiple Network Transports Clients C O M TCP, UDP IPX, SPX HTTP C O M Queued Client Machine Server Machine COM Object DCOM: Flexible Security Clients C O M NT4 Security TCP, UDP SSL/ IPX, SPX Certificates Kerberos HTTP IPSEC C O M Queued Client Machine Server Machine COM Object What’s next? COM+ Evolutionary step, making it even easier to build and use components Infrastructure in the system, not in the application Extensible services Preserves current investments in COM Provides benefits across languages and tools Less coding, more productivity COM+ Strategy Transactions Data Binding Persistence Load Balancing Security In Memory Database Event Infrastructure Ubiquitous Type Description Dynamic Invocation “No-Leak” Memory Mgmt Interception Tools Ubiquity Market Binary Standard The COM+ MODEL COM+ is the next step in the evolution of the Microsoft® Component Object Model and Microsoft Transaction Server (MTS). COM+ handles many of the resource management tasks such as thread allocation and security. COM+ automatically makes applications more scalable by providing thread pooling, object pooling, and just-in-time object activation. COM+ protects data integrity by providing transaction support, even if a transaction spans multiple databases over a network. The COM+ MODEL COM+ still provides a standard library, and objects and their clients still use it. COM+ hides calls to this library beneath the equivalent native functions in the programming language. C++ programmers can use the standard new operator rather than CoCreateInstance() to create a COM+ object. COM+ developers no longer need to define interfaces using IDL. Object's interfaces defined using their programming language's syntax. The COM+MODEL COM+ addresses another important but challenging problem in creating a languageindependent object model: data types. Different languages support different data types, which causes problems when passing parameters between objects written in different languages. COM+ allows implementation inheritance between COM+ objects running in the same process. COM objects do not support constructors, but COM+ objects do. COM+ constructors even allow passing parameters, better integrating COM+ objects and the objects used by today's most popular object-oriented languages. COM+ Philosophy Attribute-based Programming Write your Logic Set Attributes Runtime Does all the grungy stuff Interceptors deal with the object based on the Attributes Different Interceptors provide different extensible services at Runtime The key to extensible services: Interception Key concept in “COM +” run-time Interceptors provide automatic behavior at runtime based on the attribute set Interceptors assure that when a transactional object attempts to change data either all succeed or all fail and rollback Interception Events Instance creation Method call and return, field access Force fail pre and post call Binding an instance to a reference Dynamically (re)define method COM+ and Windows DNA For building next generation applications The Web • • • Easy to Deploy Graphical UI Dynamic The Windows PC • • • Rich application services Familiar UI for users Consistent management Windows DNA • Integrates client/server and the web • Services that work together • Open protocols and published interfaces COM+ Applications • Component-based • Flexible and dynamic • Built-in scalability • Preserve current investments • Extensible services Summary COM is the most widely adopted object model in the world COM+ builds on the success of the Component Object Model Provides benefits across languages and tools Less code, more productivity Extensible services enabled by interception Provides the backbone to Windows DNA Questions?