I'm new to COM, and I don't know what it is or why it exists.
Is this a programming methodology like OOP? Do programming languages have to support it? (with some special keywords or something)
When I asked my professor about it, he said:
COM is a binary-stable way to do OOP. We need to know binary-layout (something..something..)
I've no idea what it means. Some people say it is used for code reuse. OOP does a good job at that already, so then why did this COM evolve in the first place?
What is it with C++ and COM? Wherever I see COM, it's is always described with abstract C++ examples. Is it only for C++?
Can any one show me a case or exmaple so that I can understand the need for COM? What are the requirements for learning this, so I can write my own components?
Component Object Model (COM) is a simple Microsoft specification method that defines a binary standard for exchanging code between two systems, regardless of the OS or programming language. COM provides access to distributed client object services and is used to share cross-platform binary code and programming languages.
Component Object Model. Component Object Model (COM) is a binary-interface standard for software components introduced by Microsoft in 1993. It is used to enable inter-process communication object creation in a large range of programming languages.
For some applications, COM has been replaced at least to some extent by the Microsoft .NET framework, and support for Web Services through the Windows Communication Foundation (WCF). However, COM objects can be used with all .NET languages through .NET COM Interop.
Rather, COM specifies an object model and programming requirements that enable COM objects (also called COM components, or sometimes simply objects) to interact with other objects. These objects can be within a single process, in other processes, and can even be on remote computers.
COM at its core is a way of providing a data-passing contract which is independent of any specific language. It is provably not language dependent, as there are many languages which support COM (there are C++, C, .NET, and Java implementations)
In practice it is useful for a couple of different examples:
COM was first created as a mechanism to allow Microsoft Office applications to communicate with one another, then, in its second iteration it was modified and extended to become a specification for how binary code components could--if they were constructed according to the specification-- communicate with each other, and share data, no matter what language or OS they were built upon (as long as the binary file (the compiled .dll or .exe) conformed to the COM specification).
The purpose was to allow "binary reuse" which means that a code component could be reused by multiple client code components, that the original code component knew nothing about, and which were not even in existence when the component was originally compiled. To quote from one of the original architects of COM, Don Box:
[...] The design paradigm of COM was that component contracts are expressed as type definitions. This was a step forward from the world COM replaced, in which contracts were expressed only as simple functional entry points.In this respect, COM was a major advance because it brought the dynamic loading of code and the type system together in a fairly consistent manner.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With