GuidesFirst Impressions of C#: Java Killer or Java Wannabe?

First Impressions of C#: Java Killer or Java Wannabe? content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

"With the lack of support of Visual J++, both on the part of developers and Microsoft, a Java-like language with innovations will be of interest to the entire development community.


Last year, rumors surfaced that Microsoft Corp. was developing a new language to compete head-to-head with Java, dubbed “Cool”. It will not come as a surprise to many readers that the relationship between Microsoft and Sun Microsystems is strained, and legal action is still pending — so a strong competitor to Java would be extremely advantageous for Microsoft. As part of recent announcements about the Microsoft .NET platform, came the debut of C#, a new language derived from C++. Though Microsoft is careful not to mention Java in relation to C#, the gauntlet has been laid down for competition.

So What Is the C# Language?

Before discussing any opinions on the language, let’s look at the official company line:

“C# is a simple, modern, object-oriented, and type-safe programming language derived from C and C++. C# (pronounced “C sharp”) is firmly planted in the C and C++ family tree of languages, and will immediately be familiar to C and C++ programmers. C# aims to combine the high productivity of Visual Basic and the raw power of C++.” [1]

Already, C# sounds similar to Java in its list of properties, and they both share a common origin in C++. By aiming for a simple language, Java achieved significant productivity gains over that of C++, and eliminated many of the “pitfalls” that you can run into with direct pointer manipulation and multiple inheritance. Nonetheless, Java has always suffered from the perception (real or imagined) of poor performance when compared to C++. So a simpler language with C++ performance is certainly an ambitious goal.

However, Microsoft hasn’t just stopped there. C# is a truly “modern” language, in that it has been designed with the Internet and component architectures in mind. Under C#, any object can be represented as a COM object, allowing easy integration with applications written in other languages. This also makes C# ideal for writing small components for use in larger projects, and will likely lead to some significant productivity gains over other component architectures such as JavaBeans, which are hard to deploy and integrate with non-Java languages. The C# language also includes built-in support to turn any component into a Web-based service that can be invoked remotely, similar to remote method invocation (RMI). Unlike RMI, however, developers aren’t limited to a specific language. However, as of this writing, precise details of this feature were not yet available.

Though Microsoft is careful not to say the “J-word”, both the common ancestry and similar features make C# a strong contender in the battle for the hearts and minds of software developers. While an attempt to undermine Java through the inclusion of Windows-specific features in its Visual J++ product failed, Microsoft may just have a winner in the form of C#. It borrows many useful features from Java, and when you add the fact that C# gives access to low-level native resources, along with the Windows API (see site), the language is going to be a strong competitor. While it won’t be popular with the 100% Pure Java crowd, C# may just win over enough Windows developers to make it a threat.

Reaction to C# from the Java Community

The reaction to Microsoft’s announcements of C# by the Java community has, as one might expect, been mixed. Many developers are pleased with the long overdue retooling of C++, while others are less than receptive and even hostile. While some criticize the move on purely ideological grounds (anti-Microsoft rhetoric), others question the inclusion of individual language features such as native pointers. Of course, the developer community has only the initial language reference documentatio, and has yet to actually write code for C# using the tools of an integrated development environment. It is likely that most developers will await the release of the next version of Visual Studio before making any strong judgments either way.

So What Is C# Like?

There are many features that make C# an attractive choice over C++. Whether these will be attractive enough to sway Java developers remains to be seen — a lot will depend on how C# performs and how easy it is to program in using Visual Studio. However, on purely language issues, let’s see what C# has in store and how it compares to Java.

First, since it draws heavily on C and C++, you’ll not be surprised about features such as pointers, multiple inheritance for interfaces, primitive data types (or classes, for types like bool, int, decimal, float, etc.), enumerations, and nascent preprocessor directives. Many new features have been added, some of which bear a startling resemblance to Java, and others which are completely new.

Some of the most important new features for C# are:

  • automatic garbage collection
  • support for interfaces
  • type-safe and automatically initialized variables
  • COM and Windows API support
  • versioning
  • delegates


As each of these features are important in their own right, I’ll discuss them in detail in part two of this article. However, it’s worth noting just how many of these features are “Java-like,” in so far as they were introduced in Java and will thus be comfortable and familiar to existing Java developers. Garbage collection, interfaces, and type-safe variables are part of Java’s feature set. However, C# isn’t a Java clone, as it adds some very handy features of its own, which Sun ought to consider including in any revision of the language. Nonetheless, with the lack of support for Visual J++, both on the part of developers and Microsoft, a Java-like language with innovations will be of interest to the entire development community.

In part two (
First Impressions of C#: A Language Overview
), I’ll show you some of the unique and borrowed features of C# and how they can improve the productivity and robustness of C++ code.


    1. C# Language Reference, Anders Hejlsberg and Scott Wiltamuth, Microsoft Corp., 2000.

About the Author

David Reilly is a software engineer and freelance technical writer living in Australia. A Sun Certified Java 1.1 Programmer, his research interests include the Java programming language, networking and distributed systems, and software agents. He can be reached via e-mail at or through his personal Web site.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories