11

I am a fresh graduate with a bachelor in Computer Science. As most school today, they are no longer teaching students C or advance C++ (only an Introductory course in C++... With lessons up to Pointers). The standard programming language prescribed in the curriculum is C# (.NET stack).

Just recently, I got hired as a junior software developer. 95% of our codebase is in C++ and our products are using COM/DCOM. The other 5% is in .NET. My current responsibility is to maintain a project written in .NET (ASP.NET) and I am not required to study C++ and other technology YET. But I want to learn COM as soon as possible so I can help out on other projects.

So I am seeking the advice of this community on how I can go about learning COM. My current questions are the following:

  1. Any required reading? (Pre-requisite topics)
  2. A Good Site in Learning the basics of COM?
  3. A type of Simple Program to really appreciate the "purpose" of COM (A chat program perhaps?)

Thanks! :)

PS: Should I mark this as a community wiki?

rekire
  • 47,260
  • 30
  • 167
  • 264
Ian
  • 5,625
  • 11
  • 57
  • 93
  • 2
    Just remember there is a good reason why alternatives to COM were produced. Do a search on "DLL Hell".. – RobS Jun 05 '09 at 07:35
  • 2
    Just wanted to throw in that most schools do not teach only the MS stack. Lots still teach on C/C++/Java. – Bob Somers Jun 05 '09 at 07:36
  • 1
    @Rob: Yup. But most companies today are still using COM. So its a good thing to learn it. @Bob: Yes. Some universities here teaches Java. – Ian Jun 05 '09 at 07:53
  • 1
    COM does try to solve the DLL hell problem - or at least that was one of the intentions. – Aardvark Jun 11 '09 at 13:14
  • Possible duplicate of http://stackoverflow.com/questions/900123/com-com-dcom-where-to-start/ – gast128 Oct 22 '15 at 15:25

8 Answers8

9

To learn the very basic ideas behind COM, I've never come across anything better than Inside COM by Dale Rogerson. This is an old book, but it explains very clearly why COM is needed and how it is implemented, and you can pick up a second hand copy on Amazon.

As for the Don Box books, I've read all of them and I think they are pretty damn poor. Box neverr explains the motivation for the code he descrribes and uses deeply unrealistic examples. But I realise this is a minority opinion.

9

I have in my library these books on COM which I'd recommend:

  1. 1995 - Kraig Brockschmidt - Inside OLE 2nd Edition
  2. 1998 - Don Box - Essential COM
  3. 1999 - George Shepherd - Inside ATL
  4. 2000 - Andrew Troelsen - Developer's Workshop to COM and ATL 3.0
  5. 2006 - Christopher Tavares - ATL Internals : Working with ATL 8, 2nd Edition

and if you say you have some .net background there's the

  1. 2003 - Julian Templeman - COM Programming with Microsoft .NET

Hope this helps.

da_m_n
  • 821
  • 7
  • 10
8

The book of Don Box about COM is the definitive reference. Amazon link.

Beware is a tough read, but it covers everything in deep. And remember, as Don said... COM IS LOVE.

I do not believe you can find a lot of web site, COM was a up to date technology a lot of time ago, but if you can forgot about it trust me... it's better!

massimogentilini
  • 4,102
  • 5
  • 29
  • 32
  • 2
    I agree completely. In this book (Essential COM), especially the first chapter is worth reading, because it explains the concepts & reasons behind COM. If you understand that completely, the rest isn't so hard... – Arnaud Gouder de Beauregard Jun 05 '09 at 08:15
  • I just checked and we have this book (Its an OLD book) in our library! :) Thanks! – Ian Jun 05 '09 at 08:15
  • 1
    You can download chapter 1 for free, for example from: http://www.informit.com/content/images/0201634465/samplechapter%5Cchap01.pdf – Arnaud Gouder de Beauregard Jun 05 '09 at 08:15
  • 3
    IDispatch sucks, but i need the bucks. -Don Box (tech ed - circa some year where people cared about this stuff) – Aardvark Jun 11 '09 at 12:53
5

There are plenty of content available online in msdn :-)

  1. To Understand COM http://msdn.microsoft.com/en-us/library/windows/desktop/ms680573(v=vs.85).aspx

  2. To use COM http://msdn.microsoft.com/en-us/library/windows/desktop/ms690156(v=vs.85).aspx

After reading these follow this tutorial for developing a complete end to end COM sample project ..

http://www.codeguru.com/cpp/com-tech/activex/tutorials/article.php/c5567/Step-by-Step-COM-Tutorial.htm

Rahul Sundar
  • 480
  • 8
  • 26
3

Some classic books already mentioned here. I'll also throw in Designing Component-Based Applications by Mary Kirtland.

It is old (as most titles mentioned are), and is mainly aimed at Enterprise developers. It has a nice overview of COM without getting too deep in the weeds, talks about 3-tier development, discusses MTS (the book predates COM+) and its uses. It also talks about designing data and business components and walks through developing a sample application.

I'm not sure how well it has aged but I remember 10 years ago it was a great introduction to the world of COM. The strength of the book is that it assumes that you know nothing about the topic. It nicely balances theory with practical implementations in a logical progression. I think there is some ASP (classic) in there too...so for the love of all that is holy skip that part. :)

I remember that Dr. GUI had some great COM articles (e.g. Dr. GUI's Gentle Guide to COM) but was unable to track them down.

Randy Levy
  • 22,566
  • 4
  • 68
  • 94
2

Read the Don Box book for all you could ever want to know (and forget) about COM.

As for the purpose of COM: Whereas C++ gives you (source) code reuse, COM gives you (compiled) component reuse.

Daren Thomas
  • 67,947
  • 40
  • 154
  • 200
  • If I compile something to a DLL and told everyone to copy it to their machine, it is considered as a "compiled" component reuse right? – Ian Jun 05 '09 at 07:52
  • 1
    right, except COM goes a bit further (interface based polymorphism, reference counting for memory management etc.) – Daren Thomas Jun 05 '09 at 12:33
1

I would recommend the book ATL Internals, it may be getting a bit old but it will teach you the basic fundamentals of COM. As the tho poster commented, the Don Box is good as well.

Shane Powell
  • 13,698
  • 2
  • 49
  • 61
  • I don't agree. This book was great to understand the underpinnings of how ATL works *internally*. I found that to be distracting from understanding how to just use ATL (let alone COM in general). I wouldn't open this book until you understand some fundamentals. – Aardvark Jun 11 '09 at 12:52
  • Before I read this book I didn't know anything about COM. It taught me both ATL and COM. Maybe it should be recommended for good programmer that has a solid understanding of programming paradigms? – Shane Powell Jun 11 '09 at 19:45
0

It's obvious, but have you visited microsoft site for COM? That's how I started, later I just googled for info when I stuck at something (which was a lot, COM's nasty at some points). I also asked a lot my co-workers, nothing's better than face-to-face explanation on some voodoo you can see in code

grapkulec
  • 1,022
  • 13
  • 28
  • As much as possible, I want to stay away from MSDN since it involves a really technical discussion. (At least for now) – Ian Jun 05 '09 at 07:51
  • 1
    whatever you meant by that, I think msdn is first source of info about anything made by MS, you get story behing it, api reference, samples... and then you can google out because you know what to enter in the search text box :) – grapkulec Jun 05 '09 at 08:01