Com Dcom
Com Dcom
Component Programming
COM / DCOM
T. V. Prasad
Assistant Director (IT Services)
Bureau of Indian Standards
In this presentation….
• Part 1 – Introduction
• Part 2 – The Component Object
Model (COM) Technology
• Part 3 – Distributed COM (DCOM)
• Part 4 – Microsoft Component Services
Part 1
Introduction
The COM Technology
Microsoft
COM
COM is a standard for communicating
between objects. The basic idea is to
have a standard that says objects will
accept and send messages in a
particular way, thus enabling objects
written in disparate languages to
communicate with each other as if they
were written in the same language
Genesis of COM and
change in technologies
• Disk Operating System (DOS)
• Object Embedding & Linking (OLE)
• Conventional GUI based OS, e.g, Windows
• Dynamic Data Exchange (DDE)
• Object Oriented Programming (OOP)
• Component Object Model (COM)
• Distributed COM (DCOM)
• COM+
Merits of COM
• Automatic transactions
• Configurable security
• Automatic thread support (many users at a time)
• Support for multiple databases and resource
managers
• Database connection pooling
• Component state management (easy versioning)
• Process isolation through packages
• Integration with main-frame transactions
• A broad range of development tools
Demerits of COM/DCOM
• Programmers need to change their thinking and
methodology from being property-oriented to
service-oriented
• Installation of DCOM components is more
involved since it has to be made sure that client
knows about the services offered by server-side
components and their location
• Components located over network can be slow
due to network traffic
• Security could be concerning while deploying
components
• Error handling could be cumbersome since error
has to be sent to the client
Applications of COM/DCOM
Manufacturing, Hospital, Airline,
Railways, Commerce, Banking
Industry, Telecom, Transportation,
Tourism, Education, Science &
Research, Government, Space,
Defence, Law & Order
– and many more in everyday life
Software Tools for COM
The
Component Object Model (COM)
Technology
Important terms – 1
• Object – combination of code and data that can
be treated as a unit
• Component – reusable piece of executable code
that can be used with other applications with
minimum efforts; could be .EXE, .DLL or .OCX
• Interface – set of functions grouped together
under one name; COM can support more than
one interface
• DLL – dynamic link library is a highly reusable
component that can communicate with objects in
client/server application
Object
Properties
or
Attributes
or
Data
Methods
or
Functions
or
Code
Usage of COM
Interfaces B Object
C
Interface extend toward clients
Client Object
Interface
Application Pointer
Applications connect each other
Application
Object
Interface
Pointer
Object
Application
Important terms – 2
• Distributed environment – a network
environment where information or COM
components can span on server as well
as client machines
• GUID – globally unique identifiers are
128 bit integers used to identify every
interface and component object class
• Business rules – the middle layer of the
three layer COM architecture
3-level architecture of COM
Oracle
Client 1
Products
Standard
Object
EXE
Client 2
Standard Access
EXE Customer
Object
Accounting Package
– A Case Study
Accounting procedure throughout the world
follows same principles for General Ledger,
Accounts Receivable, etc. but there are
numerous applications running everywhere
Enormous time is required for software
development. It is notable that over 100
million accounting packages are available in
the market
Contd…
If one COM-compliant accounting module is
available, then all a programmer has to do is
write a custom GUI and processing; but leave
the accounting procedure to the software.
Clearly, the programmer do not have to think
about the accounting system at all.
Similar applications can be envisaged for
power plants, super markets, banks, etc.
This goes with the saying “Don’t reinvent
wheel” (rather use the existing technology).
Straightaway, it can be said that COM sets
standards (or business rules) of the business.
Edge over 2-tier architecture
• Easily replaceable – entire coding or business
rules need not be changed; small change can be
made and get that part only replaced
• Ideal for changing business requirements –
business logic can be localized, nicely organized
and then distributed to clients
• Reusable – write the code once and then use it
in many applications
• Hides complexities –management of complex
validation part and business rules could be
handled easily
Support behind COM
COM is
• Language independent
• Location independent
Part 3
Distributed COM
(DCOM)
Distributed COM
COM behaves like a distributed component
as, neither is it bound in the process space
of one process, nor is it stopped by remote
computer. When a call from a remote host
is marshaled, the model used is called
Distributed Component Object Model or
DCOM
Y = GetObject( ,“Excel.Application”)
This will get reference to the already
running application, and if none is running
then an OLE error is flashed
Key benefits of ActiveX
automatically extend to DCOM
• Language neutral
• Broad tools support
• Broad industry support
• Accessible technology
Use of Interfaces
Local
object
Cross process
COM with lightweight RPC
Local Remote server
object process
Remote COM
object Cross network
with true RPC Remote
object
Local/Remote
Transparency Benefits
• Common solutions to problems that are
independent of distance between client
and server
• Programmers leverage their learning
• System implementation is centralized
• Interface designers concentrate on
design aspects
Part 4
Microsoft
Component Services
Microsoft Transaction Server
DCOM
MTS Database
Database
ASP
HTTP IIS Script
COM+
Thank you