COM

Started by
6 comments, last by smr 19 years, 9 months ago
What is everyones thought on using COM for engine components? I'm writing my engine in dlls using C++, but I plan on writing editor tools in VB that use some of the engine components. Is COM the best way to go? Thanks
Advertisement
I doubt it. COM is a great tool but it's a pain to use (takes a long time to really get into a COM frame of mind for coding) and it's designed more to let seperate components communicate over one or more computers. For instance a property sheet dialog can be told via COM that some of its data needs changing by the item who's data is being displayed. You certainly can use it for games and it would be an interesting project if you already know COM well, but for performance and ease of development I really wouldn't recommend it!
Ive read this big blurb about com in a book of mine but i cant actually figure out what it is. can sumone plz explain it?
The basic concept of COM is simple, it's a reference counted system for pluggable components.

Quote:Microsoft says:
COM allows an object to expose its functionality to other components and to host applications. It defines both how the object exposes itself and how this exposure works across processes and across networks. COM also defines the object's life cycle.



Basically, you derive a class from the IUnknown interface and have to implement AddRef(), Release() and QueryInterface() methods - your module is then entirely self contained and can be used with anything that supports COM (VB does by default). There's obviously more to it that this simple explanation, but for basic understanding, this is sufficient. I'm guessing that the thing of real confusion is OLE, which is based on COM and is a whole host more tricky.

Here's a couple of links:

A simple COM tutorial

COM: All you need to get started
DirectX uses COM. DirectX is not a pleasure to program with, IMNSHO.
Crystal Space uses a cut down version of COM called SCF (shared class facility), which is easier to work with, so you might want to look at that.
OLE should simplify COM by doinf it for you IIRC? COM is not simple - you have to really think in terms of interfaces - C++ classes have nothing to do with it apart from making reusing code easier.
I think it's the other way around. COM simplifies OLE. OLE is COM interface hell, but I don't imagine how much worse it would be without something like COM.

This topic is closed to new replies.

Advertisement