Quite often programmers develop the ability to write COM components but are still hazy about what COM really is. So let's make a one-line definition of COM. COM is a specification and a set of services that permit us to create applications that are language-independent, modular, object-oriented, distributed, customizable, and upgradable. Let us now take apart this definition word by word.
COM is a specification
The COM specification describes the standards that you need to follow in order to create COM components. This standard describes how components should look like and how they should behave. COM is a set of services The COM specification is backed up by a set of services or APIs. On Win32 platforms these services are provided as a part of the operating system in the form of a COM library. In other operating systems they are provided as a separate package.
COM components are language-independent
COM is a binary standard. The components can be written in any programming language as long as they follow a standard memory layout prescribed by COM. As of this writing, the number of languages and tools that support COM include C, C++, Java, JScript, Visual Basic, VBScript, Delphi, PowerBuilder, MicroFocus Cobol, etc.
COM allows modular programming
COM components can be distributed either as DLLs or as executables. Components present in different modules can communicate with each other through the communication mechanism provided by COM.
COM is object-oriented
COM components are like normal objects. They have an identity, state and behavior. COM components along with COM interfaces support the concept of encapsulation and polymorphism. COM enables easy customization and upgrades to your applications. COM components are linked one another dynamically. Also there is a standard way of locating a component. Hence we can replace an existing component with a new one without being required to recompile the entire application.
COM enables distributed applications
The components can be transparently relocated on a remote computer without affecting the clients i.e. local and remote components are treated in the same manner. This makes distributed computing very easy.
What COM Is Not?
COM is not a computer language. In fact, COM can be implemented through a variety of languages.
COM doesn't replace DLLs. In fact, components are often implemented as DLLs to exploit the ability of a DLL to link dynamically.
COM doesn't stand for OLE controls (that's ActiveX), compound documents (that's OLE DB and ADO) or game and graphics programming (that's DirectX). All these technologies are however based on COM.