The Windows Component Object Model (COM) system is a massive, massive dependency. How big and complex is it? Well, I usually list it on my resume as a separate line item.
When you first decide to incorporate COM-aware code into your application, you’re signing up to import an entire ecosystem of macros, interfaces, types, headers, class-specific smart pointers… and headaches. Naturally, it makes sense to try and segregate that mess from the rest of your pristine code. Encapsulate it in the smallest container possible. In general – when I require functionality from a COM type – I immediately abstract it away, behind a more user-friendly, ‘standard’ C++ helper class or interface.
If you do it right, consumers of your code never need to know it’s utilizing COM at all. Continue reading “Abstracting away Windows COM dependencies”