A Symphony in C#

One of my favorite scenes from the film "Amadeus" is when the king, with a disputable ear for music, dismisses Mozart’s latest composition as having "too many notes." Likewise, Microsoft’s carefully orchestrated rollout of their Next Generation Windows Services, now called .NET, ended up sounding like a cacophony of vision, vaporware, and the promise of some deliverables over the next couple of years. Too many notes. Amongst the dissonance of competing and complementary announcements, an interesting note met my development-tuned ears -- piercing through as if at a slightly higher pitch than the rest of the composition. Microsoft announced the development of a new language that both extends and pulls back on the functionality of C and C++. It's not just C, it's C Sharp (C#).

As with the king from "Amadeus," many of you may feel like there are already too many languages. Why should we not dismiss C# as just another Microsoft bid to repel Java and control the computing world? To begin with, the language will not be proprietary: Microsoft already submitted the specification for C# to the European Computer Manufacturers Association, an international information systems standards body -- something Sun has yet to do with Java, by the way. The run-time portion of the language, known as the Common Language Infrastructure (CLI), is a separate standard. CLI can, in theory, provide write-once-run-anywhere functionality to C#. The tune that C# is singing is the speed of C++ with safety and productivity exceeding the best Java environment. I’m listening.

As I read the specification for C#, I felt like Mozart reading the sheet music from an great opera that had yet to be played aloud: I could easily imagine the robust software that could be produced. The inclusion of automatic garbage collection in C# prompted immediate comparisons with Java, but the truth is that C# is more of a clean-room simplification and extension C++. When I discovered that the maestro behind C# was Anders Hejlsberg, the same man who conducted Borland’s Delphi and C++ Builder and Microsoft’s VJ++’s WFC extensions, it all made sense. It's exciting to think that Hejlsberg may finally have the opportunity to produce a nonproprietary language.

The language has many of the same simplifications to the object model as Object Pascal and Java, such as single inheritance, virtual elimination of the "->" operator, and garbage collection. To this mix, C# adds true multidimensional arrays, array indexers, and a simple method for iterating over array contents. The C# compiler includes a preprocessor a la C, but it does not require forward declarations -- a combination that should result in a very fast compiler with more flexibility than Java to target insurmountable platform differences. C# "delegates" provide a fast and safe solution wherever function pointers would normally be required. C# supports explicit reference parameters and offers "syntactic sugar" that improves both readability and encapsulation.

C# starts playing an entirely unique tune by providing language features to support extending base classes while preserving binary compatibility with derived classes. Via C# "attributes," programmers can add their own metadata to the definition of classes and members, enabling brand-new features direct code and database integration. C# allows dangerous but fast coding practices like pointer manipulation in special blocks of code explicitly marked as "unsafe," due to the compilers inability to assure correctness. Finally, components created in C# can immediately become Internet services, and vice versa. In fact, from my five-page diatribe about the qualities of an ideal programming language ("Perfect Application Development", ENT October 1996), C# is missing only template-based coding.

With all this potential, will C# soar to the heights of Mozart or languish in obscurity like his mediocre contemporary Salieri. From reading hundreds of posts on development Web sites, the development community is decidedly mixed. Many of the Java religious and fervent anti-Microsoft developers dismiss the language outright. Most who have taken the time to read the specification have found the language proposal impressive, but continue to have reservations about Microsoft’s ability to adhere to standards. Those unfamiliar with Hejlsberg’s previous track record don’t believe Microsoft will be able to deliver -- but they will.

I personally believe the biggest risks are threefold: providing the CLI layer that it is not simply the Windows API, clearly differentiating C# from Java, and using a product name that is incompatible with most Internet search engines, including Microsoft’s. I believe Microsoft could easily win over developers by delivering a CLI layer for Linux and Macintosh along with the expected Windows product. Give C# a listen at http://msdn.microsoft.com/vstudio/nextgen -- it’s an interesting unfinished symphony. --Eric Binary Anderson has led projects at a number if enterprise software companies and is currently the senior architect at IBT Financial, an Internet-based training company in Bend, Ore. Contact him at ebinary@columnist.com.

Must Read Articles