This node is still here for historical purposed and for support for the nodes bellow it. I've learned a lot more than what I knew back in my school days, when I wrote this. I'll add, as time permits, an accurate account of the facts.

This node describes and documents the differences and the similarities of two programming languages, namely Java and C#. These programming languages are meant to satisfy the same kind of needs and are best suited to a certain type of project, the "enterprise application". Naturally, this rivalry sparked countless debates and comparisons, and this node tries to separate the truth from the vaporware and the FUD (fear, uncertainty and doubt).


Buzzword no. 1: "4th generation languages"

Both Java and C# are 4th generation languages. In simple terms, this means that they are both quite evolved and complex. These languages are typically used for advanced "enterprise applications" like:

These are highly specialized applications that are generally developed "in-house" (each company develops it's own) and are not typically sold like regular software (in a box, with a manual)


Buzzword no. 2: "Platform"

Java and C# by themselves are more or less useless. Because of the high degree of abstractisarion used, they both relay on a set of applications and libraries that connect the language to the OS (operating system) and different data sources (databases, directories, etc.).

These components, took together, are called a "platform". It's actually these platforms that programmers use to create the end applications.


A little history

Java was created at the Sun Microsystems research labs (http://research.sun.com/) as early as 1995 and was designed to be a platform for mobile computing and non-PC devices. After the Internet boom of the 90s, it soon became well known due to annoying little applications called "applets" which ran inside the web browser. In the late 90s, the Java platform had evolved in one of the most complex systems for client-side computing but mostly for server-side applications (interactive sites, like eBay, email, news and chat).
Sun, capitalizing the momentum of Java, created the "Java 2 Enterprise Edition" platform, a complete and mature solution for database-driven applications. This will be later incorporated in the "Sun ONE" (Open Network Architecture) initiative for web services.

About 2 years ago (1999) the Microsoft Corporation (http://www.microsoft.com/) was offering several 3rd generation languages, including MS Visual Basic and MS Visual C++, bundled in the "MS Visual Studio Platform". These offered little regarding web technologies or portability, but were widely available because of their ease of use and powerful integration with MS Windows.
After failing to "embrace and extend" Java, a technique often used by Microsoft to control and monopolize other companies' intellectual property, Microsoft decided to enlist the help of Borland Delphi veterans to develop it's own enterprise platform.
This platform's name was .NET and it was all about "web services", a new and exciting concept taking over the IT&C news sites. But this new platform needed a new language to replace the problematic and baroque Visual C++ … enter C# (pronounced "C sharp").


Buzzword no. 3: "Web Services"

"Web Services" refers to different technologies that enable:

1. A common login for a single user to all sites (resulting is a single username/password combination being used on all systems)
2. "Smart" server-side services/sites that connect to one another to create a realistic context and real-time integration for the user.

This concept exists now mainly as proposals and un-tested protocols. This being said, if such systems are ever to be implemented on a large scale on the Internet, they will probably use SOAP, which is compatible with both Java 2 Enterprise Edition and .NET.


Buzzword no. 4: "n-tier architecture"

As far as performance is concerned, both Java and C# are too slow to be used in games or most "regular" applications, they are designed to be used for "n-tier systems".

"n-tier" means that the applications is spread between different computers, each one doing a specific task. This is an extension of the classical and popular "client-server" architecture.

The tiers are:


Industry support, the decisive factor

Java and C# are very much alike. Some would say C# is just a Java clone, deployed by Microsoft in a hurry to catch the new wave of Internet computing (distributed computing, web services, etc.). Even from this point of view, C# is still a powerful alternative to the widely used and stable J2EE platform.
What .NET lacks is wide industry support. Most important IT companies dealing with server technology have their own J2EE implementation and have been selling these for over 2-3 years now. By the time this node was completed, few companies manifested interest in joining the Microsoft side, as the .NET platform was yet unreleased (an early beta3 was available).

C# has some added programming features like pointers and operator overloading, that have been removed from Java because they were considered as problem-makers and obsolete, even in 1995. Overall, C# presents some improvement in code style and syntax but most differences are not missed while working with Java.


Buzzword no. 5: "the open monopoly"

The recent success of open-source software (properly called "free software"), like the GNU project, while used for servers and server-side applications, determined a Sun analyst to claim the beginning of an "open monopoly".
More and more, open systems (GPL or not) are used because of their performance and reliability. Although they might not be as user friendly as Microsoft's packages, they are "free" (as in no cost) and "free" (as in open-source).

The Java 2 platform (Enterprise Edition, Standard Edition or Mobile Edition) is a good example of open software. It's not GPL but the sources to the libraries and platform are open and free (no cost). In contrast, Microsoft's platform is all "closed".

This raises the issues: how does Microsoft expect to have success with its new platform, a totally proprietary system, while most companies are looking for open software that enabled growth and cost reduction, without locking you into a certain vendor's software?


Open source implementations

Because of licensing issues, related to Sun patents, a truly open-source (as in GPL, artistic license, Mozilla license or BSD license) version of Java is not available. This means that all the 4-5 language implementations (Sun, IBM, Blackdown, etc.) are proprietary, even if they are free (no cost) and in some cases the source of the libraries are also open (Sun's).

What Java does have is a full J2EE implementation licensed under the GPL, called JBoss. The latest version implements all the J2EE specifications and is 100% compatible with other implementations, like Oracle's for example. This means that one can build cost-free, high performance servers, running Linux as OS, JBoss as application and web server and PostgresQL as database, at virtually NO software cost, while still enjoying the latest in "enterprise computing".

On the other end of the spectrum, Microsoft's .NET lacks any open source, or even free, implementation. A linux company, called Ximian, is working on porting the C# language to Unixes but it won't be able to implement some vital parts of the .NET platform, greatly reducing the overall usability of the software.


Buzzword no. 6: "WebOS"

The "web os" is the name different analysts gave the trend of porting and developing applications for the n-tier architecture, where the client is connecting with a web browser, via the Internet.

The increased reliability of corporate networks and even the Internet itself, coupled with the thin-ness of the HTTP (web) protocol has created a perfect environment, accessible to PCs and portable devices alike.

Instead of writing traditional software and installing it on several hundred computers across the enterprise, contemporany programmers choose to develop dynamic web site.
Advances in DHTML, XML and JavaScript enable highly interactive interfaces, while keeping all of the administrative work centralized on the server. Patches can be applied on the fly, without any software being modified or installed on the client's machine.

With the successful development of the Mozilla and Konqueror browsers for Unixes and portable devices, Microsoft's monopoly (as determined by the US Supreme Court) on the desktop market becomes more and more irrelevant. Applications are no longer written for Windows or for Linux... they are written for the "WebOS", actually a set of standards formed around (XHTML, DHTML, XML, JavaScript, Java Applets and CSS).

So, in this battle, Microsoft will be unable to leverage its desktop monopoly as it did with Netscape, as some analysts would suggest.


My conclusion

It seems to me that Sun's offer is more than complete, both in terms of programming performance and TCO (total cost of ownership, usually obtained by adding to the purchase cost the costs generated by mainteinance and training).

Microsoft's solution brings insignificant performance and style improvements over current systems, and the lack of Java-to-C# porting tools will turn the transition from a platform to another into a full blown application rewrite, even if the languages are similar.

Even if these platforms are being developed with web services in mind, the bulk of applications will still be day-to-day intranet reporting and management tools. Java tradition]'s in the field, and the increased use of "alternative" platforms such as Zope (Python-based), Cocoon (XML-based) or Jabber will leave little room for Microsoft's .NET.

On the other hand, Microsoft has thousands of Visual Basic programmers caught in endless pay-upgrade-pay cycles, more than willing for a change and its marketing] techniques have saved the company more than once.

Java has become very portable, running from cell phones (J2 Micro Edition), to desktops (J2 Standard Edition), large servers and even old COBOL mainframes (J2 Enterprise Edition). Meanwhile C# binds the programmers to a single OS, Windows, a single IDE, Visual Studio and a single architecture, IBM-PC (Windows runs on Intel x86, IA64 or old and obsolete Alphas).

Overall, this is going to be a very interesting fight that may ultimately decide the fate of the Internet as a free communication medium, and maybe even the demise of Microsoft as an IT monopoly.

As a non-non-programmer in one of these two languages, there are a few points I feel must be added to the commendable effort of SPasmofiT to explain this sticky matter. This writeup is intended as a collection of footnotes to the above. Relevant parts will be quoted. Read disclaimer below!

These programming languages are meant to satisfy the same kind of needs and are best suited to a certain type of project, the "enterprise application".

This is not completely true. The languages have more applications than "enterprise programming" and Java was by no means intended to have such a limited field of application. It is possible to create things like 3D rendering engines in Java for instance. Fairly good ones at that. It is possible to create server applications, text editors and compilers. The standard Java libraries even have classes for building compilers, which proves the point that the designers had much more in mind than enterpise applications. Even complete software development environments exist that were written in Java. Java was developed to be a normal, full blown third generation programming language. It differed from existing languages in two pivotal points: Java executable files run on any platform (that supports a Java Virtual Machine) and the syntax is more elegant than most other OO languages.

Both Java and C# are 4th generation languages.

Java and C# are not fourth generation languages. Fourth generation languages, like PowerBuilder for example, or perhaps Rational Rose RT, offer fully programmed building blocks which can be glued together by a programmer to form rounded applications. Usually, a programmer doesn't even need to know any special language to do so. In Rose RT for instance, the programmer draws a diagram of an application on the screen and Rose RT creates the actual executable from your drawing. Java and C# are much more low level than this. Let's illustrate this by saying that you have operators for shifting individual bits left and right in a register. This is about as low level as one can get. Java and C# do have extensive libraries that encapsulate much of the tedious jobs that come with low level programming, like drawing buttons on a screen, playing sounds, painting pixels on a screen, etc. Java and C# are more like third generation languages which come with a lot of standard tools.

Java and C# by themselves are more or less useless. Because of the high degree of abstractisarion used, they both relay on a set of applications and libraries that connect the language to the OS (operating system) and different data sources (databases, directories, etc.).

This is both true and not true. All languages, including C and even assembly, require help from the operating system to perform anything at all. Sometimes this help comes in the form of direct system calls, but most of the time additional platform libraries are used. Traditional C cannot even output text to the screen without a system dependent library. Further, the higher level types of libraries that connect Java to database systems also exist for C or other languages. A C program needs these to communicate with a database, just like Java does.

About 2 years ago (1999) the Microsoft Corporation (http://www.microsoft.com/) was offering several 3rd generation languages, including MS Visual Basic and MS Visual C++, bundled in the "MS Visual Studio Platform". These offered little regarding web technologies or portability, but were widely available because of their ease of use and powerful integration with MS Windows.

If one insists on calling C# and Java fourth generation languages, which we really shouldn't, then Visual Basic (especially VBA) was one too. That aside. Visual C++ had lots of web support and standard libraries. Microsoft even demonstrated that one could build a browser in under five minutes using Visual C++.(Note by the way that the language is called C++ and that Visual C++ is just the name of Microsoft's integraded development environment, a program for writing C++ programs). What became painfully clear from the Visual C++/MFC experience is that things like application wizards (which write 80% of your program for you) make it virtually impossible to write anything else but web browsers. The Java aproach offers much more flexibility and the methods used to encapsulate user interface design were much more stable, easy to use and less restrictive.

Interestingly enough, C# adds nothing to the portability of applications. C# applications will never run on anything but Windows platforms. It is however more elegant and clean than C++ and the standard libraries that came with Visual C++. It 'feels' more like Java in that respect. A platform dependent Java. What is even more remarkable is the fact that C# is even less platform independent than any of the now common programming languages, save assembly language. A C program can be compiled on any platform that supports a C compiler. So, while only executables that employ a virtual machine (like Java) work on several platforms, one single C code can be used to build unique executables for each platform, making C code source portable, where C# is not portable at all. Only minor adjustments are necessary at points where the program interacts with the operating system. With the POSIX standard, that has become even less cumbersome. By the looks of things, there will never be a C# compiler for anything but Windows. This means that people who want to develop for multiple platforms have to build one version of their application in C# and one in some other language. This is quite a shameless attempt to chain even more people to the Windows platform.

As far as performance is concerned, both Java and C# are too slow to be used in games or most "regular" applications, they are designed to be used for "n-tier systems".

This is true for gaming in Java, but it shouldn't be true for C# at all. Java has a program running 'between' your computer and the Java application. This is necessary in order to be able to run your Java program on a Macintosh, a Linux box and a Windows machine alike. This abstraction layer takes some of the computing resources so Java programs will always be a little slower than applications written in C. For anything but gaming, this is no problem however. Even for games, it will only be too slow for the most cutting edge technologies, but this naturally makes it an unatractive choice for the game developer. C# only runs on Windows so it doesn't need a Virtual Machine like this.

C# has some added programming features like pointers and operator overloading, that have been removed from Java because they were considered as problem-makers and obsolete, even in 1995.

This is an interesting point indeed. Opinions differ on this one. Being both a C++ and a Java programmer I must say that the nonexistence of pointers is very desirable at this level. Pointers are only useful in C++ for doing hardware dependent things, like rendering signals in close to realtime. This is not something that you'd want to do in Java or C#. Thus, pointers are not a 'feature' but a nuisance when writing something like a web application.

The recent success of open-source software (properly called "free software")

I can't help it: open source is not free software. There are people that would hang you for saying that!

Disclaimer: SPasmofiT makes several valid points and provides an interesting insight in this matter. I felt these comments were just a necessary addition to a good writeup. I did not intend to be pedantic.

A short response to sql*kitten's writeup below:

A short migration path from Java to C# isn't going to do much for the language I'm afraid. Software engineers don't go around looking for short migration paths all day. They preferably engineer software all day. They only migrate when there is something to gain from the procedure. Something that outweighs the cost of migration considerably. Unless C# provides some significant improvement over Java, no Java developers will make the switch. I for one am curious as to what major improvement C# brings over Java to give it a raison d'etre in the first place. It seems more likely that numerous Visual Basic programmers will make the switch, and so will C++ programmers that target Windows exclusively. Apart from those...?

this node tries to separate the truth from the vaporware and the FUD (fear, uncertainty and doubt).

It is difficult to know where to begin in pointing out the misconceptions in the above writeup, so I will attempt to address each of the points in turn.

Both Java and C# are 4th generation languages

Neither Java nor C# are 4GLs. The distinction between third and fourth generation languages is that in a 3GL, the steps required to achieve a result are specified in the program, and these result in the desired output, whereas in a 4GL, the desired output is described, but not the steps taken to derive it. The actual sequence of operations performed is generated by the language's runtime. A good example of this is SQL. An SQL SELECT statement describes the conditions that a row in a table must satisfy to form part of a set. Before SQL can be executed, the parser must generate a query plan which is the steps taken to scan tables, make comparisons, perform sorts, etc, to produce the set.

To give an example, a 3GL recipe book would list ingredients and instructions, whereas a 4GL recipe book would describe the appearance and other attributes of the finished meal, but leave it up to the chef to work out how to get there. A 3GL book is easy to use for the chef, because the author does most of the work. A 4GL recipe book, in contrast, is designed to minimize the work done by the author. In this example, the author represents the programmer and the chef the computer.

Java and C# are both 3rd-generation object-oriented languages.

These languages are typically used for advanced "enterprise applications"

There is nothing in Java or C# that makes them particularly suited for "enterprise applications" as opposed to any other large scale software project. A language that is specifically designed for enterprise applications is SAP's ABAP and BASIS environment, or Borland's Delphi. Java and C# are both object-oriented, which makes them suitable for many complex software engineering tasks. Java originated as an embedded systems language, and C# as an enhanced object-oriented C/C++ replacement. C and C++ are both general purpose programming languages.

These are highly specialized applications that are generally developed "in-house" (each company develops it's own) and are not typically sold like regular software (in a box, with a manual)

Tell that to SAP, Oracle, PeopleSoft, Redbrick, SAS Institute, JD Edwards, Baan, Siebel Systems, Kana and any of the dozens of other vendors who sell packaged software for CRM, ERP, SCM, DS etc.

Java and C# by themselves are more or less useless. Because of the high degree of abstractisarion used, they both relay on a set of applications and libraries that connect the language to the OS (operating system) and different data sources (databases, directories, etc.).

On the contrary, the languages and their runtimes are synonymous, just as C binaries and libc are. Almost every language is reliant on libraries and underlying OS services, this is by no means a unique property of Java or C#. It is common to write useful programs that are not reliant on third-party external data sources in any language. For example, there are many applications that read their data from a simple text file, perform some processing, and write out another text file.

As far as performance is concerned, both Java and C# are too slow to be used in games or most "regular" applications, they are designed to be used for "n-tier systems".

This was certainly true in the early days, but recent benchmarking by IBM places JVMs with JIT to be almost as fast, and in some cases faster than native code. How can an interpreted language be faster than a native binary? Because a compiled language cannot take into account the execution paths of the software at runtime, whereas a JIT compiler can observe the software executing and target its optimizations where they will yield the most improvement, trading, for example, memory for speed. These techniques were popularized by DEC's FX!32 technology.

It is also true that both Java and C# are designed to be used for distributed applications. J2EE with EJB and .NET are both network-transparent; invoking a method in an object can be done irrespective of where that object is physically executing. This, however, is not the same as n-tier, which is a process of abstraction separating presentation, data, and logic. The tiers may be web browser, web server, application server and database, but this is only one example. It is not the specific components that matter; rather it is the logical design (for example, all tiers could physically be implemented on the same physical device without compromising the n-tier design). An n-tier design can be implemented in almost any programming language. A distributed application is not inherently n-tier.

What .NET lacks is wide industry support.

There are 3 million VB programmers in the world with an almost seamless migration path to .NET. Java had limited support in 1995 but C and C++ programmers easily migrated to it; C# is easily adopted by anyone familiar with Java, C or C++. In addition, .NET's CLR, the underlying runtime environment analogous to Java's JVM, is language-neutral, .NET applications can be written in C#, VB.NET, C++ or even exotic languages like Eiffel.

C# has some added programming features like pointers and operator overloading, that have been removed from Java because they were considered as problem-makers and obsolete, even in 1995. Overall, C# presents some improvement in code style and syntax but most differences are not missed while working with Java.

That's a very subjective argument. Take a bug that is frequent in C and Java: if (a = 5) { doStuff(); }. This will compile and execute in Java, but will be caught at compile time by C# (the bug is = instead of ==). And pointers are very useful; modern high-performance rendering software would be impossible without function pointers. It is widely believed that features such as multiple inheritance were omitted from Java to simplify the implementation of the JVM, rather than as is often claimed, because these features aren't used by developers. Certainly my own experience is that implementing interfaces in Java means sacrificing OO benefits like inheritance and subsequent overloading of methods, particularly when invoking a superclass within an override. The fragile superclass is not a problem on modern hardware, since compilation is much cheaper.

This raises the issues: how does Microsoft expect to have success with its new platform, a totally proprietary system, while most companies are looking for open software that enabled growth and cost reduction, without locking you into a certain vendor's software?

C# and the CLR are ECMA standards; Java is wholly controlled by a single vendor, Sun, who retain sole privilege of certifying software as fully compatible, for a rather expensive fee. See http://msdn.microsoft.com/net/ecma/.

On the other end of the spectrum, Microsoft's .NET lacks any open source, or even free, implementation. A linux company, called Ximian, is working on porting the C# language to Unixes but it won't be able to implement some vital parts of the .NET platform, greatly reducing the overall usability of the software.

I will assume this is an innocent oversight, but the source code to a full .NET development environment for FreeBSD and Win32 is freely available for download. See http://msdn.microsoft.com/net/sscli/.

Microsoft's solution brings insignificant performance and style improvements over current systems, and the lack of Java-to-C# porting tools will turn the transition from a platform to another into a full blown application rewrite, even if the languages are similar.

Again I will assume this is an innocent oversight, but see http://msdn.microsoft.com/vstudio/downloads/jlca/default.asp. There is a much clearer migration patch from existing Win32/COM/DCOM code to .NET than there is to J2EE. The benefits of a near-native object model (DCOM/COM+) give great performance enhancements in C# compared to IDL-binding CORBA to Java, and it has yet to be proved that JNDI offers superior performance to Active Directory. Certainly the X.500/LDAP vs NDIS argument favors the latter for performance.

Java has become very portable, running from cell phones (J2 Micro Edition), to desktops (J2 Standard Edition), large servers and even old COBOL mainframes (J2 Enterprise Edition). Meanwhile C# binds the programmers to a single OS, Windows, a single IDE, Visual Studio and a single architecture, IBM-PC (Windows runs on Intel x86, IA64 or old and obsolete Alphas).

There is nothing to prevent CLR running on a non-Wintel platform; the standard is open, it's merely a matter of time for it to be implemented. As pointed out, it already has been for FreeBSD on x86. As DCOM was ported to Linux by Software AG with Microsoft's full support, there is no reason to suggest that the CLR will not also be ported to many platforms. The C# tools are not bound to a single IDE (I personally write C# with Xemacs and GNU Make). Further, Windows CE runs on many CPU architectures. (Incidentally, NT used to be supported in x86, i860, PPC, Alpha, MIPS and SPARC, all but x86 were dropped because people weren't buying on other platforms, hardly Microsoft's fault).

J2EE will happily run on a desktop; the difference between Standard and Enterprise is not a function of the underlying hardware or OS. Java is meant to be platform-neutral, remember? And how can it be a COBOL mainframe if it is, as you say, running Java?

I hope the writeup has gone some way to clearing up the FUD in this node. The original writeup in the node verges on propaganda, and includes many factual errors which happen to support the author's clear personal preference for Java. In truth, choosing a language depends more on the existing skills of the team, and the existing software within the organization, rather than novel features of a single language.


Response to irexe:

Indeed; I was merely pointing out one of the lies^H^H^H^Hmisconceptions in the original wu.

Log in or registerto write something here or to contact authors.