In a recent post on interop in .NET framework, Jeroen Pluimers wrote “I don’t see COM as the first class citizen it was in the VB6 era.”
I always find it funny when the .NET camp start poo-pooing COM and dismissing it as yesterdays technology that some people just can’t seem to let go of (apologies to Jeroen if this was not his intention in this case).
I find it funny because .NET is essentially COM+.
Not the COM+ that was released/delivered as such, but what COM+ was supposed to be, according to a white-paper about COM+ that mysteriously disappeared before COM+ arrived in the form that it eventually did.
That white-paper talked about a lot of things that never made it into the COM+ delivery. Common type system, common language runtime etc. Some of the components in .NET were even delivered initially with the COM+ origins writ large in their identity, as shown in a screenshot of the Garbage Collector metrics available in PerfMon in this article from the early times of .NET framework:
Garbage Collection is a strictly “.NET era” technology. COM+ as released didn’t have a GC. Yet in early .NET days the GC was listed as a “COM+ Memory” metric.
The exact same metric nowadays is listed under “.NET CLR Memory” .
Perhaps this will clear up the confusion and help explain why COM never went away, and indeed never could have.
Not Only, But Also
But how does this help us understand the Brave New World we find ourselves facing in Windows 8 ?
Well, I would suggest that talking about COM being a “first class citizen” in .NET is using a C calling convention when Pascal is required. That is, the arguments are in the wrong order. Indeed, one of the arguments isn’t even of the write type (that’s what you get for using a weakly typed language!) 🙂
The real question is whether the .NET runtime environment (and/or COM) is a “first class citizen” in the operating system.
COM is primarily nothing more than a specification, not a runtime, and Win32 implements that specification. Although lots of services are provided using COM (and expected of a COM component if it is to interoperate with other COM services nicely) and additional services implemented in compliance with the COM specification to build “macro services” that provide additional facilities that apps may take advantage of, a COM compliant application doesn’t need anything to exist in and of itself other than the core OS and to implement COM according to the spec.
Unlike .NET which is not just a specification but also a runtime environment, requiring a huge amount of scaffolding just to be able to initiate and launch even the simplest of apps.
Windows – even in Windows 8, despite the myths that the marketecture diagrams try to create – is still – at it’s core – an unmanaged, COM compliant OS.
It just happens to be provided with, and host, a .NET runtime which sits atop Win32 in exactly the same way that the Flash and Java runtimes are hosted environments on that same core OS.
It even hosts another new runtime called WinRT, which itself is an entirely new thing that takes a lot of ideas from .NET but which fundamentally builds on … yep, COM.
The Brave New World
So where does this leave us with the question of citizenship ?
Well, I would say that COM isn’t a “first class citizen”. It is far more than that (and yet also far less).
But I wouldn’t even say it is The President.
It is the Bill of Rights, where Win32 is the Constitution.
WinRT is a rewrite of the Constitution, but it is also a New Republic. A self-declared independent city state – Metro. Beyond the city limits, in The United States of Desktop the old Constitution continues to apply.
The City Republic of Metro and The Desktop States may have different constitutions (the one for Metro is much simpler – city states are much easier to govern than vast and diverse nations), but they share the same Bill of Rights. COM.