Introduction to COM and DCOM - PowerPoint PPT Presentation

About This Presentation
Title:

Introduction to COM and DCOM

Description:

ActiveX Services. Binary packaging of in-proc components ... Examined relationship between COM, OLE and ActiveX. Examined the features of COM ... – PowerPoint PPT presentation

Number of Views:2686
Avg rating:3.0/5.0
Slides: 35
Provided by: defau696
Category:

less

Transcript and Presenter's Notes

Title: Introduction to COM and DCOM


1
Introduction to COM and DCOM
  • Organizational Communications and Technologies
  • Prithvi N. Rao
  • H. John Heinz III School of Public Policy and
    Management
  • Carnegie Mellon University

2
Readings
  • Posting on the Class Web Site

3
Objectives
  • Present the basic features of COM and DCOM

4
What is COM?
  • Binary protocol by which software components can
    connect and communicate
  • Language independent
  • Platform independent
  • Philosophy for architecting software components
  • Programming discipline for component development
  • Microsofts object technology
  • Originally referred to as OLE

5
What is COM?
  • COM is a specification
  • COM is a set of services
  • COM supports modular programming
  • COM is object-oriented (?)
  • COM enables easy customization and upgrades to
    your application (?)
  • COM supports distributed applications
  • COM components can be written in a variety of
    languages

6
Activex, OLE and COM
OLE
ActiveX
Embedding Linking Drag-and-drop Compound documents
Documents Controls Scripting
Uniform data transfer Persistent storage monikers
Automation
COM
7
Role of COM in the Model
  • COM services provide foundations
  • UDT is language and program independent data
    transfer
  • Persistence provides for machine-independent
    standardized object persistence
  • Monikers facilitate file namespace object
    identification across machines
  • Automation facilitates COM object access from
    scripting clients

8
The Role of COM in the Model
COM
Uniform Data Transfer
Monikers
Persistent Storage
Automation
Component Object Model
9
Object-Linking-and-Embedding
  • OLE services allow off-the-shelf app data
    interoperability
  • Host (client/container) can edit/store foreign
    application (server) data via pre-defined set of
    COM interfaces
  • Can be user initiated
  • End-user-drag-drop of data between applications

10
Object-Linking-and-Embedding
In Place Activation (visual editing)
Linking
Embedding
Drag and Drop
11
ActiveX Services
  • Binary packaging of in-proc components
  • Deployed in windows/dialogs or in web pages
  • Dynamically downloaded with page
  • Web-based distribution pf documents
  • IIS-aware Automation-aware pages (ASP)

12
Component Object Model
Interface
Server
Client (Container)
Object
Interface Pointer
13
Distributed COM
Process Boundary
Network Boundary
Client (DLL or EXE)
In-Proc Object (DLL)
Local Object (EXE)
Remote Object (EXE)
14
COM and DCOM
  • DCOM is now a standard part of 32-bit Windows
  • NT 4.0, Win98, Win95 with IE4
  • DCOM being propagated to other platforms as well
  • Solaris
  • HPUX
  • Digitals VMS (in beta)
  • Provides transparency for remote interfaces,
    parameters and return values

15
COM and DCOM
  • Reusable code is difficult to create even in C
  • Traditional static link libraries have dependency
    deficiencies
  • Windows dlls have their own set of limitations
  • Need for a vendor independent strata for building
    reusable components

16
Lack of Reusability
  • Static Libraries
  • Duplicated code on disk
  • Duplicated code in memory
  • No way to replace library without relinking
    and/or recompiling
  • Dynamic Link Libraries (a better solution)
  • Code resides only on one system
  • Code only needs to be loaded once in memory
  • Field replacement of implementation is possible

17
COM Benefits
  • Component based suggests more code re-use
  • Smaller distributable components
  • Replaceable components
  • Binary compatibility and encapsulation
  • Thin layers of abstraction
  • Decoupling interface from implementation
  • Decoupling object identity from implementation
  • Dependency reduction in large projects

18
COM Fundamentals
  • COM defines
  • What constitutes a COM object
  • How com objects expose features for other
    components to use
  • How this works across processes and across
    networks
  • When objects are destroyed
  • No specification about implementation
  • Only describes behavior/characteristics pertinent
    to connecting/communicating with other objects
  • Allows flexibility
  • Permits implementation stay lightweight and
    language-independent

19
COM Principles
  • Object services are accessed via interfaces
  • Interfaces have identity
  • Objects consist of interface implementation
  • Objects have identity
  • Objects must be registered

20
COM Principles
  • Objects have location independence
  • Objects have implementation transparency
  • Object services can be published via a type
    library

21
Key COM Concepts
  • Interfaces
  • Objects
  • Identity
  • Registration
  • Type Libraries

22
Whats an Interface?
  • An abstract data type containing pointers to a
    group of related function
  • Contract between client and object
  • Features/functionality only available via
    interfaces
  • Objects features expressed by the interface it
    implements
  • Once published never changes
  • Existing interfaces may be extended
  • Contract between COM and object author
  • Object implements all methods in interface

23
Whats an Interface?
  • A pointer to a table of pointers to methods
  • No limit to the number of methods in an interface
  • Strongly typed
  • Transparency for DCOM implementation

24
COM Identity
  • COM components are associated with a unique ID
  • Interface (IID)
  • Objects (CLSID)
  • Type libraries (TLID)
  • Features/service groups of categories (CATID)
  • Components defined by COM have pre-assigned Ids
  • Each ID distinguishes a component from another
  • Prevents collisions
  • Supports versioning
  • Accessed via ID

25
Component IDs
  • Generated by component author via development
    tools
  • Guaranteed to be unique
  • Uses machine ID, NIC date and time information to
    create 128 bit long integer id
  • Referred to as GUID
  • Guaranteed to be unique on all systems on the
    planet
  • Can be created in multiple ways
  • CoCreateGuid from COM API function
  • GUIDGEN command line tool
  • Development tools do this automatically

26
Registration
  • System registry
  • Database of information about available objects
    in system
  • May contain configuration information
  • Updated when object is installed
  • Entries organized by IDs
  • Each COM object registry entry must specify
  • Objects CLSID
  • Path to objects server
  • Object registry entries may also specify
  • Human readable name

27
Type Libraries
  • Binary language-independent file
  • Describes COM objects, interfaces, methods, data
    types and Ids of components in a server
  • Created by component author during development
  • Used by client authors during client development
  • Compiled form a script written in DCE Interface
    Definition Language (IDL)
  • TLB provide all essential details required for
    clients to invoke objects described

28
COM Principles
  • Objects accessed via Interfaces
  • Interfaces have identity
  • Objects composed of interface implementations
  • Objects have identity
  • Objects have location independence

29
COM Principles
  • Objects have implementation transparency
  • Object services can be published via a type
    library

30
COM Interface Rules
  • Interface methods are abstract
  • Interfaces never expose data
  • All methods in an interface must be implemented
  • Interface methods must return HRESULT

31
Instantiating a COM Object
  • Client calls a COM API function with object CLSID
  • CoCreateInstance
  • CoGetClassObject
  • COM looks up objects CLSID in registry
  • COM finds the server pathname in the registry
  • COM invokes the objects server
  • Server requests an object instance from the
    objects class factory
  • Server instantiates object

32
Instantiating a COM Object
  • Server returns pointer to objects default
    interface to COM
  • COM returns interface pointer to client

33
Interoperability Issues
  • CORBA/RMI?
  • CORBA/DCOM?
  • RMI/DCOM?
  • Multiple Inheritance (CORBA) maps to Multiple
    Interfaces in DCOM

34
Summary
  • Examined relationship between COM, OLE and
    ActiveX
  • Examined the features of COM
  • Examined the principles of COM
  • Presented the activation of COM objects
  • Presented issues in interoperability
Write a Comment
User Comments (0)
About PowerShow.com