tags:

views:

1049

answers:

13

I wasn't around when all this was happening. But when I look at it now, I see Java appeared in 1995 whereas C# appeared in 2001. And the history section for C# on Wikipedia says only the following.

James Gosling, who created the Java programming language in 1994, and Bill Joy, a co-founder of Sun Microsystems, the originator of Java, called C# an "imitation" of Java; Gosling further claimed that "[C# is] sort of Java with reliability, productivity and security deleted." Klaus Kreft and Angelika Langer (authors of a C++ streams book) stated in a blog post that "Java and C# are almost identical programming languages. Boring repetition that lacks innovation."

I was left thinking as to how did these to programming languages, almost "imitations" (then) came to be. Why do you think C# came to be when the world already had Java back then?

For those of you who see subjectivity, consider the question as

What technological factors and necessities led to the development of C#? Were some of the key points not already covered by Java?

PS: I'm aware they both differ now at certain key points, as Jon Skeet points out. But they didn't seem to back when C# came out.

+3  A: 

The same reason the Microsoft makes a kagillion dollars every year. When they see a good technology they try to either buy it out or make their own.

Examples:

  • Sybase - Bought out
  • Netscape - IE Dominated
  • Bing - Good luck MS but who knows...
  • MapQuest - I would argue that MapPoint was created to compete against this
  • HotMail - Bought out
  • Visio - Bought out

The list goes on for quite a bit.

Abe Miessler
If only they didn't always crap something up in the process.
Mike Webb
Why does such an unqualified answer get upvoted?
codymanix
MS make a kagillion dollars because of two things. Windows and Office. The rest is just noise.
Mike Q
@codymanix - I think because, since it has undertones of disdain for Microsoft, most people relate to it.
Mike Webb
@Mike, if it does that wasn't my intention. I work in a Microsoft shop and love it. Just the facts...
Abe Miessler
Shrug I see this as a positive answer, it says Microsoft adapts to the market. Prior to Win7 Microsoft might not have had the best operating system but they were the best at business which is where the money is.
Chris Marisic
@Abe Miessler - I figured that wasn't your intention. Your statement is true, and there are great things about MS, but there are things that just get under my skin. The things that get under my skin just seem more numerous that the things that don't. I guess that's why I interpret your answer as just a little sarcastic.
Mike Webb
+1  A: 

I think one thing to consider also is that C# was not created in an internal vacuum, either; .NET itself was being developed, which was originally intended to be the next iteration of COM.

Andrew Barber
+4  A: 

Microsoft needed a modern platform for windows development which would be as simple as VB6 and mighty like [D]COM. Both were already a bit rusty and microsoft needed a good replacement, they also feared that Java would dominate programming in some time.

Java is not the best way to program for windows, since you cannot access the Windows GUI and API directly, also the Java GUI is much slower than the native Windows GUI and doesn't look like it. Also, you need to install the JRE to get programs to run.

codymanix
The point about the JRE seems nonsensical, since MS had to develop the .NET framework to run .NET code on Windows, and could have easily devoted that effort to a first-class MS JRE.
jball
(and some java class libraries that could do all the windows GUI stuff...)
jball
@jball: 1: The were forbidden by sun to to that 2: This would defeat the essentials of java and see 1.
codymanix
@codymanix - (1) I find that doubtful. Microsoft made a JVM in the late 90's, and if I remember correctly got in trouble because they claimed it supported more of the java API than it did, not because they made one. (2) As long as it served the purposes of MS, why would they care about preserving the essentials of WORA?
jball
I found [a JavaWorld article](http://www.javaworld.com/javaworld/jw-10-1997/jw-10-lawsuit.html) about the situation, and it was what I remembered. MS made a JVM that added to the core API and did not have JNI or RMI support, but they called it 1.1 compliant, and that got them in legal trouble.
jball
Except it was ridiculous because JNI and RMI are native extension mechanisms that are, by their nature, non-portable. As such, they did nothing to reduce the portability of Java.
Mystere Man
+3  A: 

Initially C# and .net were developed by Microsoft to create next generation framework for Windows development. Java was taken as example, a lot of it's features were adopted. But MS didn't plan to take features of Java longer and they significantly splitted after C# 2.0 (.net 2.0), and now they are common in only very basic parts.

Andrey
During that time, Microsoft took most of java's goodies since they also had they own java JVM (basically it complied to Sun JVM except written by Microsoft).
The Elite Gentleman
@The Elite Gentleman MS's JVM and .net served completely different purposes. MS JVM eventually was closed.
Andrey
@Andrey, yes...but while it was active (and it was) alot of similarities came from the experience MS had when working on their JVM.
The Elite Gentleman
@The Elite Gentleman: That's a very good point. MS's experience with J++. How about you put your points down in an answer?
Ashish
@Ashish, I could but most have been said here.
The Elite Gentleman
+23  A: 

Microsoft originally was on the Java bandwagon with their own implementation/JVM. However they fell out with Sun over licensing and I think Microsoft were trying to put extensions into the Java API which was a big no no for Sun who wanted a common standard (and you have to applaud Sun for this at least, having a 100% common API was a big part of Java's cross-platform credentials).

So Microsoft decided to write their own C-based language with a API/VM for it (C# and .NET/CLR). .NET was wider than just C# as it also supports VB and C++ (plus a few others I'd guess).

Initially C# was a poor cousin of Java, the collection library was (and to some degree still is) pretty poor. However with the advent of features such as first-class functions, lambdas/closures and LINQ, C# is moving ahead of Java and personally C# now shades Java in productivity for a lot of simple stuff using Linq.

Java is trying to catch up now with 7/8 supporting closures but I have my doubts whether they will come up with something as good/simple as C#s syntax. That should take a leaf out of MS's book and just nick the good stuff!

Mike Q
... the collection library is poor? You must be out of date on your .NET knowledge. With the recent introduction of the parallelized collections with .NET4 I would say there is no language platform that comes close to the completeness as .NET out of box. Also the entire generics functionality they added in 2.0 revolutionized programming even if it was similar to C++ templates the final result was much more than that.
Chris Marisic
@Chris, you know that's not what he said. Allow me to correct you: `the collection library was (and to some degree still is) pretty poor.` Emphasis on `was` and `to some degree still is`
Abe Miessler
I'm rebuking "to some degree still is" what could you consider *just* EQUAL to .NET4's collections from core languages?
Chris Marisic
@Chris In Java there are `TreeSet` (RB tree) and `ConcurrentSkipListSet` (Skip list) that don't have analogs in BCL. I don't say that java is better because of it, just an example
Andrey
@Ashish, while I'm honoured about adding my comments, I've actually posted this as an extra history lesson. :-)
The Elite Gentleman
@The Elite Gentleman: I've rolled-back my changes.
Ashish
@Mike: This is one of those times when I wish I could split the check-mark into two. +1
Ashish
@Mike: While not a *real* solution for Java catching up, you can get some of that functionality by using an embedded language like JRuby (esp when 1.9 support pops soon).
jcalvert
@Chris - Fair point. I haven't played with .NET 4 yet. The remaining omission was the lack of an ISet interface which looking quickly now it appears has been added in v4.
Mike Q
@Mike I didn't even realize they added that, I've never had a need for a ISet. +1 for amending your answer and showing me something new also.
Chris Marisic
+1  A: 

Think of it as forking a project. Your starting point might be exactly the same as the original project, but now you're free to take it in different directions. Microsoft has done that (not the forking part, since it didn't start out exactly the same, but the different directions part) with C#.

Bill the Lizard
Something like they wanted to take Java in a different direction but since they had no control over Java's future, they decided to have C#?
Ashish
@Ashish: I can't say if that was their intent all along, but it sure seems like it based on the progress they've made.
Bill the Lizard
A: 

At the beginning of C#, compared to the rest of computer languages, Java and C# were almost twins.

Microsoft paid hundreds of millions of dollars to Sun for Java related patents.

I find it despicable that the C# camp never gave any credit to Java. Of course, from Anders Hejlsberg(C# inventor)'s point of view, there is nothing new under the sun, he didn't steal anything from Sun, just many old ideas well know to computer scientists for years.

Yet, in 1990s, the idea of Java was preposterous. Sun deserves a lot of credit to push this seemingly academic and toy language to the industry, and proved that it rocks. Without Sun's work, Anders Hejlsberg will not be hired by Microsoft to create a similar product.

irreputable
Nope, Anders Hejlsberg would have still worked on the .NET framework except he'll be pushing VB extensively.
The Elite Gentleman
What was preposterous about Java then, and still today, was the idea of "write once, run anywhere". 15 years later, and Sun still hasn't managed that feat other than for rather simple applications. Microsoft recognized this from the start and while they built in platform neutrality, they also didn't hold it as gospel in anything other than the core set of libraries.
Mystere Man
Anders was hired away from Borland specifically to build C#. He wouldn't have moved without the incentive to build his own language. And while C# (and the framework) were certainly heavily influenced by Java, Java was heavily influenced by smalltalk and others. Anders was a protoge to Phillip Kahn, who started Borland and Kahn worked with the infamous Niklaus Wirth who created Pascal, Modula, Oberon, etc.. Anders basically comes from languages far beyond Java and that's where his influences come from.
Mystere Man
So C# isn't platform independent but then why not run it natively and not on a VM?
Ashish
@mystere-man Java's creators have given plenty of credits to c/c++/smalltalk/lisp etc.
irreputable
Microsoft pays millions of dollars to Java due to trademark violations, not patent related issues. Microsoft was punished for releasing Microsoft Java as "Microsoft Java" when Sun said it didn't authorize the use of the word Java to the "Microsoft Java" product name because that implementation wouldn't pass Sun's Java Compatibility Toolkit. Microsoft said, "Well take me to court over it" and Sun did. Sun won the case and was awarded further damages for Microsoft not pulling the product from the market place until after the lengthy court battle.
Edwin Buck
@edwin-buck MS paid Sun $900 million to resolve patent issues. http://www.microsoft.com/presspass/press/2004/apr04/04-02sunagreementpr.mspx
irreputable
Java is a great language. Its just another stepping stone as all languages are to better and greater things to come. I really don't care about who takes who to court, how and when. The real problem though when talking about languages is open source. I do not trust Larry Ellison one bit with Java. Its just a disaster waiting to happen. Same problems with Mono, as long as they remain relatively off radar all is ok, but the time will come when they will have to pay the piper. Python, Perl, Ruby, Haskell, Erlang etc anyone :)
WeNeedAnswers
+1  A: 

It all comes down to simple business logic:

  • Microsoft makes money (lots of it) from platform lock-in, particularly around Windows and Office
  • Sun created Java which was (at the time) a cool language that looked great for the internet. Microsoft jumped on the bandwagon.
  • Microsoft then realised the risk of a fully portable language for their Windows platform lock-in. If everyone could run Java programs on any machine, Microsoft's platform monopoly would be under threat.
  • Microsoft tried to create extensions to Java that would lock Java developers into Windows (see Visual J++). Sun (rightly) told them that this was against the terms of their Java license. Big court case ensues, Sun basically wins.
  • So if they can't subvert Java, Microsoft is basically left with the option of letting Java destroy their platform monopoly, or creating a competing product that they control. Microsoft chooses the later and .Net is born.
  • .Net starts out as a pretty basic clone of Java (C#) and the JVM (CLR), of course over time it starts to develop in different directions and hence we see all the diversity that we do today.
mikera
This is, of course, they cynical view. Another view is that Microsoft tried to make Java successful (on the desktop, Java became very successful on the server but could never truly break into the desktop except for games). Being successful on the desktop means taking full advantage of what the desktops have to offer. Write once, run anywhere is attractive to developers, not consumers. They want what runs best and gives them the best "experience". If Microsoft were so concerned about locking people in, why would they make C# and the CLI international standards. Sun refused to do that.
Mystere Man
The fact is, .NET is highly successful on the desktop, and is even more successful as a multi-platform desktop than Java is.
Mystere Man
A: 

C#/.NET History Lesson

bancer
+6  A: 

(Just to add to what's already mentioned here).

Also, just to clarify why C# and Java were almost identical (when C# was introduced) is due to this person, Anders Hejlsberg. He was actively involved in the Windows Foundation classes for J++, (J++ is Microsoft's implementation of Java) which (as you know, J++ conformed to the Java language specification, with the exception of JNI, RMI, etc.), allowed Anders to see advantages/disadvantages of Java and incorporate it in C# (which he still is a development lead to this day).

Wiki article on Anders:

The Elite Gentleman
well, strange choice for Accepted Answer
Andrey
@Andrey, LOL...I am shocked as well, because by the time I posted my answer, there was already an accepted answer (Mike Q's answer). Strange indeed.
The Elite Gentleman
@Andrey: But then I did like this point too. How should this point be visible visitors who come back later down the line.
Ashish
I don't know about you guys but c# looked and felt a lot more like Delphi than java. :)
WeNeedAnswers
@WeNeedAnswers, Anders Hejlsberg **was** the author of Turbo Pascal and the Chief architect of Borland Delphi. No suprrise there.
The Elite Gentleman
+1  A: 

The .NET platform was intended to be as language-agnostic as possible from the beginning -- one runtime (the CLR, a virtual machine) running its machine instructions (IL, or Intermediate Language) compiled from source code created in any of a number of languages. There was Visual Basic .NET for programmers who were comfortable working in the VB idiom, J# for the Java-inclined, and C# for those used to working in C and C++. (This was at a time in the great Long Ago, before there were any real language alternatives for the JVM.) Java and the C family of languages are very similar to begin with, inheriting their basic syntactical structure from Algol; the primary difference between J# and C# was at the level of minor differences in language keywords and operator characters. The reason there were two such similar languages to begin with was to flatten out the learning curve -- a developer would have to spend a considerable amount of time learning the libraries, but shouldn't have to stop and think about basic language details. There was more apparent similarity between C# and Java arising from the way libraries are accessed than from the languages themselves.

There has been an increasing amount of convergence between C# and Java, and it hasn't all been because of movement on Microsoft's part. Java has learned a few tricks from C# over the years as well. And J#? Well, it was never too popular to begin with. It didn't use the standard Java libraries (it used the .NET libraries, of course) so the convenience of keeping a handful keywords intact was far outweighed by the need to forget all of the no-brainer library functions (standard class methods for data types you'd use every day without thinking). Add to that the history of enmity with Sun over Java implementations, and the cost of maintaining the language just wasn't worth the bother.

As for why a whole new VM was deemed necessary, well, that had mostly to do with the corporate desktop. Have you ever run a major desktop application written in Java (especially those written circa 2003, like the then-current versions of OpenOffice.org or Eclipse)? Have you tried to run it on a typical corporate "we'll upgrade the hardware every seven years whether we need to or not" machine? JNI and SWT didn't begin to make up for the performance and resource problems. VB6 was good for RAD GUI apps, but it had some major limitations (especially data type incompatibilities when accessing external DLLs) and Visual C++ was inaccessible to the average cubicle drone. The .NET platform killed a lot of birds with the fling of a single stone (common data types across languages, optimized access to the native platform APIs, etc.).

Note: I'm not a .NET fanboy, nor do I develop anything on that platform these days, but I do understand the corporate dev environment. C#, and the .NET platform, filled a major void at the time, and its acceptance had at least as much to do with the merits of the solution as it did with Steve Balmer yelling "developers, developers, developers!!!" on stage.

Stan Rogers
Note also the huge array of academic and toy languages that target the CLR. They made that possible from the outset. One of those toys was F#, which now has an official niche. IMHO, Java was (and I believe is) much closer to a cult in behavior, raising huge barriers to calling code on the outside in foolish support of "write once run anywhere".
RBerteig
A: 

I think a good point to note that C# took a lot of concepts from Java and in some cases improved them, and also added a lot of new features to the language such as LINQ.

Both are great platforms for development but I think C# is starting to get an edge over Java, and Im glad I have both available to me as opposed to just one of them.

kyndigs
+1  A: 

Money. Why pay the organ grinder when you can play the thing yourself and take a bigger share of the profit.

I'm not into this whole technical argument of what is best, because as far as I am concerned its all about the Benjamins.

The argument that Microsoft just buys in technology I think is wrong and very naughty to say. Microsoft does make its fair share in the IT market place and they do innovate. Don't get me wrong I am no Boy lover of Microsoft, but fairness where fair is due, without Microsoft there would be nothing worthy to compete against. They have and still do set the mark in some areas, although they are having a rough time of it trying to compete with something as broad minded as open source.

Hopefully like IBM one day they will see the light and realise that its all very symbiotic and need to get out of the 1980's and start thinking bigger, better and wiser about where they will be in 20 years time. Hopefully Windows will go open source.

Why does google succeed. Simple, they understand the new business way of taking small chunks from lots of people, instead of big chunks out of everyone.

By the way, a little history lesson. Anders Hejlsberg came from Borland with all his wonderful Delphi knowledge, came to Microsoft and started with J++. He then moved across to c#. I moved ship from Borland to Microsoft when he moved, and for good reason. he is one of the best in the field. Take a look at Delphi which precedes java and you will see that most of the constructs look a lot like Delphi. C# for me is Delphi done with curly brackets :)

WeNeedAnswers