COM Advantages? Disadvantages?

Started by
6 comments, last by DeadXorAlive 18 years, 7 months ago
Hello, lately I have been interested in better coding design and the use of interfaces. At our Engineering Library I recently picked up "Inside COM". In the book it says that COM is the future, and pretty much goes on to tell how it's like the coolest thing since sliced bread....but...I know nothing really that uses COM, except of course DirectX. Is COM good for game programming? After reading a couple sections it seems like it would be. Like for the graphics sections.. It seems like you could just simply create a graphic interface, then design a component that uses DirectX..then later if you feel like switching you could make a component that could be used for OpenGL instead. (Of course I could be totally wrong). I really like the idea of everything being seperate from each other, and easily updatable. On most DirectX tutorial I've read COM is normally mentioned as an area that you really don't need to know much about, and is rather difficult, but so far in the book..it seems really easy to implement (lots of thinking on the design part...but..easy to use) How come not many programs use COM? (Or Do they?) Is it good for game programming? In what aspects? Is it recommened to use COM? Or are there bigger and better things out there now? Sorry if this is the wrong place for this type of question...I figured since I know nearly nothing about COM, I would put it in For Beginners instead of General Programming. Thanks Everyone, ArchG
Advertisement
Eh? A bunch of things use COM to my knowledge. Pretty much all of Office, most office-like apps like Lotus Notes... I'd bet most of Microsofts other PC software products use it.

I've only used it to allow scripting languages [like PHP] to use the COM interfaces fairly easily and do some powerful things. From the other side, it's always seemed like COM was one of those things that looks good on paper, and less so in implimentation.
Thanks Telastyn,
I guess it did say in the book that Word and Excel and the likes would start use COM and such so as you could open up an Excel sheet in a Word Document and things of that nature. But in Games is it ever used? You say it's something that looks good on paper and not so good in implentation...Would you recommend staying away from using COM then? Or is the designing an App to make full use of COM just really difficult?

Again thanks for your reply Telastyn.

ArchG
It's not often used in games to my knowledge, no.

My knowledge and experience with it is not enough to give advice to its use, and I do not know the root reason the engineers I've known/worked with have shied away from it.
COM is really a kludge to allow code written in one language to be called by code written in another. Games are typically written all in one language (or if they use scripting, two).

Because there is not usually any need for a game to be scriptable in arbritary languages, moreover, game programmers don't want the hassle of setting up COM interfaces into stuff, COM isn't used much in game programming.

If they make the game "moddable", it's unlikely to be arbritary languages, just one that the original maker has allowed. A lot of things since Quake (with its "QuakeC compiler") have had non-native code interpreters built in. This makes stuff easy.

Moreover, it makes it difficult to port the app to a platform where COM does not exist (example: PS2).

I've seen apps on Unix which used COM through some third party emulation layer - it ain't pretty.

Mark



The concept of interfaces and having different DLLs supply implementations of them can be useful in game programm (The Source engine makes extensive use of interfaces and DLLs) however you don't need COM to implement it. You'd probably be better off writing your own lightweight implementation rather than using COM.

Quote:In the book it says that COM is the future


.Net has superseded COM, so now .Net is the future. Of course given the nature of the industry in 5/10 years something else will be the future [grin]. Though COM is still used all over the place.
MSXML uses COM in a very well designed manner. Other than that I have only used COM with DirectX.
ToDoList.GrowthRate = WorkRate*2, it's more efficient to not work.
I don't know anything about OLE/COM, but happen to come across this criticism / rant. It mentions the book you refer to in a footnote. Maybe you find it interesting, so I thought I'd mention it.

What's Wrong with OLE? The Insider's story

This topic is closed to new replies.

Advertisement