<<< the cynic


Sunday, April 20, 2008 09:25 PM >>>

everything you need to know about COM

Sunday,  04/20/08  08:53 PM

<rant optional="absolutely">

Everything you need to know about COM:

// Success codes
#define S_OK    ((HRESULT)0x00000000L)
#define S_FALSE ((HRESULT)0x00000001L)

For those of you keeping score at home, please note that since time zero in all computers everywhere a nonzero value has meant true, and a value of 0 has meant false.  In their infinite lack-of-wisdom, the COM designers decided to invert this convention.

This really is everything you need to know about COM.  It was clearly designed by junior programmers who weren't even aware of the most basic programming conventions.

How does this happen?  Big companies like Microsoft hire the best and the brightest, the smartest young kids coming out of school.  These people are smart, but they are not knowledgeable.  They haven't lived long enough to understand that reinventing the wheel is not only inefficient, it leaves you with two different wheel designs to maintain.

About twenty years ago I worked on a computer called the IBM Series/1.  We ended up doing quite a bit of debugging of the operating system, and IBM eventually hired us to maintain the OS for them (I am not making this up).  I saw exactly the same thing; a system designed by smart young programmers without experience, full of wheel reinventions and neglected programming conventions.

Just about everywhere you care to look in the software development world, there are two ways to do things, the Microsoft way, and the other way.  In just about every case, the other way came first, and then Microsoft came along, ignored what had been done before, and reinvented the wheel.  Their size and market share have allowed them to survive with an incompatible approach. 

Probably the best example (or worst offense, depending on your view) is in browsers; all over the internet there are two ways to do things, the Microsoft IE way, and the all-other-browsers on all-other-platforms way.

In fact .NET itself is like this; first there was Java, everyone used it, and then Microsoft reinvented it.

So what about .NET?  Certainly Anders Hejlsberg (the designer of .NET) is smart and experienced.  The API design is – by general agreement – brilliant.  Or at least much better than Win32 / GDI.  It is however also incompatible with Win32 and GDI, a major reinvention of the wheel.  It could be argued that this was necessary in order to clean things up and move forward.  Maybe.  It could also be argued that the net amount of work for everyone in adapting old code to a new API exceeds the benefit.

{And where does that leave VB.NET?  Not brilliant, IMNSHO, not necessary, and not even helpful.  Just a needless wheel reinvention.  So much work has been expended in converting VB 6 to VB.NET, for so little benefit.}

One final note.  When a function succeeds, the status is ERROR_SUCCESS.  In addition to having a beautifully ambiguous name, the value of ERROR_SUCCESS is zero (false).  I am not making this up.


Oleosaurus out...