from Hacker News

COM+ Revisited

by lowleveldesign on 1/29/22, 5:11 PM with 69 comments

  • by davidpolberger on 1/30/22, 9:40 PM

    I spent a couple of years (while working a full-time job) writing my master's thesis on "component technology" -- COM, CORBA, .NET assemblies, OSGi and the COM-inspired object model developed at Ericsson and Sony Ericsson for use in cell phones. This was back in 2009.

    I tried to make sense of how all these disparate technologies fit together. Give it a read if you like (CC-licensed):

    http://www.polberger.se/components/

    http://www.polberger.se/components/read/

    http://www.polberger.se/components/thesis.pdf

  • by RantyDave on 1/30/22, 9:00 PM

    COM is (IMHO) one of the great underrated technologies. Registering all the classes, interfaces etc. in the registry - not so much. But IDL's, versioned interfaces etc. etc. are all reinvented every five years or so. And it's fast as hell.

    DCOM was awful.

  • by 0x0 on 1/30/22, 9:14 PM

    I always wondered if COM+, the new version of COM, was originally going to be named COM2 ... until somebody tried to create a new visual studio project in a directory named COM2...
  • by mwattsun on 1/30/22, 7:51 PM

    I read about "Software ICs" in Byte Magazine in the 80's. I later thought COM was a decent try. The implementation and tooling around it was always problematic. People do buy software components off the shelf now, like special graphing controls in Excel for example, so it continues to be a useful paradigm. The Software IC concept got coopted by OOP, which isn't the way I first understood it.

    Graham Lee blog post about Brad Cox's Object-Oriented Programming:

    In 1714, Gottfried Leibniz published La Monadologie, in which he proposed that at the fundamental level, objects are made of indivisible entities called Monads. You can’t see inside a monad, it has an internal state that controls its actions and passions. Monads can be created or destroyed atomically, but cannot be partially built or partially annihilated because they are a “simple substance without parts”.

    Cox, on the other hand, opens with the story of Eli Whitney and the industrial revolution. For Cox, the industrial revolution is not primarily about machinery and the harnessing of steam and coal power. It’s about the replacement of artisanal, cottage manufacture with scaled-up industrial processes that depend on well-specified interfaces between standardized, interchangeable parts.

    https://web.archive.org/web/20191220204822/https://deprogram...

    https://news.ycombinator.com/item?id=21833331

  • by Const-me on 1/30/22, 9:06 PM

    I like many parts of COM, but I believe that example mostly demonstrates bad parts, with IDL, registrations, and over-engineered support libraries.

    There's nothing wrong with exporting factory functions from DLLs. Microsoft does it all the time, APIs like Direct3D, DirectDraw and Media Foundation don't come with type libraries are they aren't registered anywhere.

    Speaking about support libraries, I once made my own: https://github.com/Const-me/ComLightInterop/tree/master/ComL... Compare examples from that article with this one: https://github.com/Const-me/ComLightInterop/blob/master/Demo... That source file is the complete DLL which implements a minimalistic COM object.

  • by jbandela1 on 1/31/22, 1:24 AM

    A few years back, I wanted to see what you could do if you really used modern C++ with the COM principles. This is what I came up with:

    https://github.com/jbandela/cppcomponents

    * There is no code generation or IDL files

    * Components implement IUnknown

    * You can have Constructors and static functions for C++ classes.

    * You can take std::vector, std::string, std::tuple as parameters and return them (even if you are using different compilers and standard libraries)

    * Cross-platform

  • by userbinator on 1/31/22, 3:55 AM

    COM has always felt like one of those "OOP and architecture astronautism gone off the deep end" technologies. A ton of boilerplate and indirection to do very little, with the associated bloat at both development and runtime. All the times I've used it, it was not because I wanted to, but because I was forced to.

    Here's a fun contrast/example:

    https://docs.microsoft.com/en-us/windows/win32/dlgbox/using-...

    https://docs.microsoft.com/en-us/windows/win32/shell/common-...

    Non-COM: fill in a structure and call a function.

    COM: make a dozen (doubly-)indirect function calls.

  • by MichaelMoser123 on 1/31/22, 4:29 AM

    Wow, haven't heard about COM/DCOM for over twenty years (though i had some flashbacks, when starting with gRPC). I remember they had an evangelist named Don Box, i think he even had a tattoo on his body that had to do with COM; Now wikipedia says that he worked at microsoft until last year, i wonder what he is doing now. https://en.wikipedia.org/wiki/Don_Box

    I mean, if one would tattoo some software architecture, then one would have to change the tattoo every ten years, as the subject inevitably becomes obsolete; bother!

    well, almost everything becomes obsolete, with the exception of Unix; that fact could serve as an indication for the alien origin of this operating system ;-)

    Another flashback from working with Windows: the MSDN CDs had the best documentation that i ever saw; no one comes even close...

  • by tezheng on 1/31/22, 4:28 AM

    I noticed IGameObject in the post. I've been playing with both Unity3D and COM for several years, and kept thinking about the similarities. COM has been considered bad constantly, but base on the popularity of Unity3D, IMHO COM theory shows its advantages in building an open system(plugin-friendly).
  • by hbarka on 1/31/22, 7:21 AM

    I can recall how easy it was to write and compile a COM dll and have it running instantly in IIS. Everyone running Windows Server 2nnx had IIS. It was a time to be alive.
  • by pronlover723 on 1/31/22, 4:22 AM

    I remember using the OLE COM viewer and seeing all the 1000s of APIs I could call. Some of them even had embedded docs. I always thought "wow! if I only I had an idea I could use all these apps and libraries together".... but I never did

    https://flylib.com/books/en/3.294.1.109/1/

  • by mandarax8 on 1/30/22, 8:45 PM

    Do people still code like this?
  • by jmull on 1/30/22, 7:12 PM

    Seems crazy to me to use WIL instead of ATL as your C++ COM wrapper.