Analysis: Objective C considered harmful

Common Topics

C# is the work of Anders Hejlsberg, the former Turbo Pascal and Delphi luminary who was the most prominent Borland staffer lured to Redmond in a stream of defections between 1996 and 1997. Later Borland alleged that a "Dead Borland Society" of ex-Borland employees at Redmond was poaching key staff from their old employer, with Anders signing up for a reputed $3 million. Borland eventually settled out of court on favourable terms, and to confuse those Microsoft head-hunters removed itself from the 'B' section of the Scotts Valley telephone directory by changing its name to Inprise.

So what's it like, and what exactly is the point?

Well, syntactically it's very Java like, and from a distance, the two are practically indistinguishable. Look closer and you get the definite impression that its authors know Java pretty well, but were annoyed by some of its idiosyncrasies. For example, our Anders and his fellows are obviously very keen on C-style pre-processing, and C# has its own way of importing classes. But on the whole, the similarities are far more striking - even when they go by different names - than the differences. Both do their own garbage collection, for example, and frown on willy-nilly overloading.

But what's left out of this spec is far more interesting. It's a pretty bare boned language description, and doesn't describe a security model, or come with a library of ready-to-roll classes. Microsoft is trying to throw this as a language pitch, not a platform pitch, and won't let anything get in the way of the message.

For example, in C# every object is a COM object, but there's no reason we can see from reading the spec that these couldn't be JavaBeans or other objects. But again, the authors are playing it straight and there's no deviance from the pitch. This is just a language, OK?

But you're probably left wondering why Microsoft should want to pitch a new language at the world, and even weirder, why now?

Viewed through Redmond spectacles, it does make some sense, albeit at the cost of admitting that Real Men Don't Eat Visual Basic. Over the years the VB community has gained more and more O-O features, and in theory at least, a semblance of robustness, but the downside has been that COM projects frequently end in tears when VB is being deployed. Visual Basic in COMland is really just a wrapper for C++ classes - which typically work fine - except synchronisation and tidy error handling really aren't possible. So C# gives Microsoft a grown-up language to throw at developers that has a far shorter learning curve than C++.

So some brownie points there. But we wonder, if hacker kudos was really the goal, why didn't Microsoft set Anders on a couple of more obvious options which would have certainly got it there quicker?

For example, many of the C# design goals are met in the form of Objective C, which predates Java and is undergoing something of a renaissance given the popularity of Apple's WebObjects. Objective C is well supported as GPL'd free software - there's even a GNU compiler.

And an even more cunning route was at hand, as the redoubtable maintainer of the Java site Cafe Au Lait, Rusty Harold Elliot points out. Elliot, a long time critic of Sun's licensing tactics, notes: "If Microsoft wanted to really challenge Java, they should have gone with Python. I just don't believe it's possible for any major advances in language design to be made while restricting oneself to the mistakes Kernighan and Ritchie made 30 years ago."

Well, quite. The open source language Python has not only proven itself macho enough in heavy duty production environment, it's simple enough to be taught as a first language to kids. And it's interfaced with COM interface for several years now. Maybe someone in Redmond thought it was time to unleash some "innovation" at the world, and cometh the hour, cometh the new programming language.

Finally, we can't help notice that Microsoft's PRs have gone out of their way to deny that this ever had anything to do with the Cool project reported last year. Well, have a poke around the extended attributes attached to the language reference document, co-authored by Scott Wiltamuth. He's added the following tags. Owner=scottwil Team=VC Feature=Cool.

For such heroism in the face of his own PR flaks, we feel obliged to give the waggish Wiltamuth an honorary Register lapel badge. Scott, mail us and it's yours. ®