tags:

views:

172

answers:

4

Hello,

Lately I'm hearing much about COM at my work. I also learnt that COM is old. COM is deprecated. There is no future for COM. Are these true too?

I'm want to learn COM because I want to know what is the big fuss about it, but I'm unable to convince myself that this is a solid reason for spending so much time and learning it.

So, Can any one tell me:

  1. Why should I learn COM?
  2. Once I learn COM what can I do using it? I mean its applications.
+4  A: 

Learning COM (or at least being au fait with its concepts) means you can integrate with thousands of existing components, including Microsoft Word and Excel.

I work largely in the Java domain, but having a little knowledge of COM means I can interface effectively to Word and Excel (in particular) to programatically create/read documents. I don't have an in depth knowledge, but I have a little, and having that increases my productivity substantially.

Brian Agnew
+4  A: 

You should learn enough about COM to know that you don't want to learn any more.

The details of COM - particularly from a multithreaded or C++ application - are excruciatingly irritating, and I would not wish them on anyone (I don't know them myself, but I know enough to know this).

Therefore if you do need to call a COM library, you should learn enough COM to be able to do so, then stop. Ideally, use a language such as C# or Delphi where some (or hopefully most) of the details are handled for you relatively transparently.

There are a lot of COM libraries around, but if you feel you want to use one, you should look at its specific documentation for how to do this - it probably has a reasonable example that you can simply adapt for your own use without too much effort. If it does not, then it clearly isn't very good and shouldn't be used.

MarkR
Excruciatingly irritating sounds hyperbolic to me. COM apartments (I'm assuming that is what youre getting at from the multi-threaded comment) and marshalling aren't _that_ complex, especially if you take the time to read the right resources. Plus, in C++ you can use the ATL as an abstraction layer to hide most of the boilerplate stuff.
Phil Booth
Fair enough, maybe I was overstating it. But it's still nicer to not have to worry about them :)
MarkR
+8  A: 

I just don't see COM going away any time soon. If you want to be a windows expert, you must understand how it works.

Pavel Radzivilovsky
+4  A: 

COM is definitely worth learning to at least some level if you are a Windows developer. Another common case for its use, in addition to the others already mentioned, is in the implementation of binary behaviors and BHOs for Internet Explorer. They are both implemented using COM interfaces between IE and your code.

I'd also like to recommend a couple of resources for learning about COM:

  1. Don Box's Essential COM. It is an excellent description of why COM is the way it is and really helps you get a deeper understanding of what is going on. If you take the time to read this book, then you will have a fundamental understanding of COM internals that will serve you very well.
  2. These two articles: { 1, 2 } ...are a very good discussion of the particular subject of COM apartments, alluded to as "excruciatingly irritating" (unfairly, imho) in MarkR's answer.
Phil Booth
The first chapter of Essentail COM gives a great overview of what problem COM is trying to solve - it's definelty worth reading even if you skim the rest of the book.
Robert Christie