What is Component Object Model (COM)?

7

I was reading this question 1 here on the site and I came across some times with the term "COM objects".

A brief survey showed me that COM means Component Object Model , but I could not extract more information than this. >

What I would like to know is:

  • What is a COM object?

  • How useful is this?

  • Is the relation of COM only to the GUI?

1 Difference between STAThread and MTAThread

    
asked by anonymous 18.04.2017 / 15:36

1 answer

6

COM is the old .NET: P

For someone else, I might explain it differently, but for anyone who understands why .NET exists, that's it. I speak .NET, from CLI specifically, not from C #. But COM works with interprocess communication.

COM was the way that Microsoft found for heterogeneous applications using various technologies to communicate without much knowledge of the details between them. Communication is done with strong contracts in the ABI and in some very specific semantics. It guarantees a standard for the exchange of objects (in a general sense, not in the sense of OOP, COM is not OOP even though it does give some facilities to manage objects in this way). It is not about API that is something specific to each application / component.

It is a beautiful one of a gambiarra, but at the time seemed a good idea. It fulfills its role. Even today a lot in Windows can only communicate through COM. Even newer Microsoft technologies use COM as a basis, for example UWP.

.NET, of course, communicates with other components external to it through COM. Not everything has to be COM but it does have some advantages as it creates a minimal common denominator without requiring too much of the components and applications that are using it.

.NET talks well with everything that conforms to it, but not with other technologies. C ++ has a very interesting model for talking to components written in C ++, but not in other ways. And so it goes with most languages and platforms. COM puts all this together. It does not care about memory models, with APIs, with code organization, none of these things. Of course it has a specification of how it should be used and any technology should conform to it. In thesis any language can work well with it, from C to JavaScript (yes JS accesses COM in certain implementations), via Java, C #, C ++, Pascal, PHP, Python, etc.

There are a number of specifics that I do not think are relevant here. It is very complicated and annoying to deal with.

  

Is the relation of COM only with the GUI?

This holds true for any technology that wanted to conform to it. It is not exclusive to Microsoft and still less GUI only.

Comparison

Some of his competitors are: CORBA , XPCOM , D-Bus , etc. Each one with its own characteristics, advantages and disadvantages.

Not directly, but you can compare it with REST which is a way for applications to chat and exchange objects. Obviously very differently by the nature and goals of the technologies.

    
18.04.2017 / 16:21