Sign in to follow this  
maya18222

COM

Recommended Posts

Does anyone know of any good resources that explain COM and how it is used today? I gather that .NET does a much better job of what COM was designed to do (making code reusable, as well as language independent), but I also notice that .net itself uses a lot of existing COM interfaces. Is this because

a) The code is written in C/C++ and is generally going to be faster?
b) The code already exists, why re-write?
c) a mix of both?

What are the downsides of COM?

From some brief reading, the idea of COM is that you can leverage on existing code bases to perform some task in a multitude of COM conformant languages (as they have to have the necessary interop code to convert data to and from COM, to something the language itself can read a result from). Which is the same idea as non .net languages having a .net port?

There are a few books on Amazon, from the 90's, are they still worth picking up? Im interested in how COM is implemented under the hood, and how other languages would adopt the functionality of being able to use COM objects.



Share this post


Link to post
Share on other sites
Two books you may interesting in,

[url="http://www.amazon.com/Essential-COM-Don-Box/dp/0201634465"]Essential COM [/url]
[url="http://www.amazon.com/Inside-Microsoft-Programming-Dale-Rogerson/dp/1572313498"]Inside COM[/url]

Even if you never program on Windows and COM, learning some COM knowledge is quite useful if you want to develop binary compatible APIs in C++.
One fact in COM I really like is the pure interface communication, which is binary compatible and highly abstraction.

Share this post


Link to post
Share on other sites
[quote name='maya18222' timestamp='1313402897' post='4849316']
Does anyone know of any good resources that explain COM and how it is used today? I gather that .NET does a much better job of what COM was designed to do (making code reusable, as well as language independent), but I also notice that .net itself uses a lot of existing COM interfaces. Is this because

a) The code is written in C/C++ and is generally going to be faster?
b) The code already exists, why re-write?
c) a mix of both?

What are the downsides of COM?

From some brief reading, the idea of COM is that you can leverage on existing code bases to perform some task in a multitude of COM conformant languages (as they have to have the necessary interop code to convert data to and from COM, to something the language itself can read a result from). Which is the same idea as non .net languages having a .net port?

There are a few books on Amazon, from the 90's, are they still worth picking up? Im interested in how COM is implemented under the hood, and how other languages would adopt the functionality of being able to use COM objects.[/quote]

One reason .NET uses existing COM objects is that .NET itself is managed and can't talk directly to hardware. Also, the decision to tie .NET to COM is that it was meant to make Windows development quicker and easier and it's just natural to use the existing Windows COM environment rather than rewriting code to interact with the Windows environment. So, to answer your question it's a mix of both. The main downside to COM is what's called DLL hell. With all the interconnectedness of the COM environment it can be hard to debug issues as the problem might not lie within any of your code. That said COM is excellent as it makes combining and mixing functionality very easy. COM itself is very easy to use though it can be somewhat interesting to implement given your language. Thankfully in .NET you can just tag a method as belonging to a DLL and the CLR takes care of the rest.

Is there a more specific answer you're looking for?

Share this post


Link to post
Share on other sites
#2 is the majority reason. [i]Many[/i] things already exist as COM components and are well tested. Many of them are also very old in computing terms (so nobody's around to work on them).

[quote name='maya18222' timestamp='1313402897' post='4849316']
What are the downsides of COM?
[/quote]

Other than it sucks?

It suffers from many of the issues you'd find in a dynamic language, if that language didn't have any of the safeguards or utilities to make it usable. You get some random unknown object, get to jump through some hoops, and assuming all of the stars align (and the API writer wasn't purposefully trying to exploit your machine) then you can dynamically do stuff.


.NET was designed with lessons learned, and basically supports the same behavior in a cleaner, typesafe, enforceable manner.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this