Sunday, September 12, 2010

Java and C# => one in the same?

Many water cooler chat's have inevitably, at one time or another, posed the notion that Java and C# are a different language or strikingly similar in nature.

I really had no stance on the issue, up until about a year ago. One of my colleague's (Tommy), pointed out that if you know C#, then you know Java. At first, take, if you have not programmed in either, you are taken aback. Can they really be similar?

Naaaah. No way. Crazy talk. But really think about it: What is so different?

What's the same about them?
Both are garbage collected runtimes (JVM, CLR)
Disallow multiple inheritance, and allow multiple contracts to be implmented
Syntactically very similiar
Exceptions anyone?
Boxing
inheritance

What's different about them?
C# always run natively, java supports just-in-time compiles (interpreted)
Packages vs Namespaces (packages require a logical directory)
Main v main
c# => partial classes
c# => unmanaged code
editors

The one main difference is that C# is growing at a faster pace at this point. With the addition of linq & lamdba functions, its clear microsoft is rapidly adding features to c#, where as the java process is way more bureaucratic. See the following link => http://jcp.org/en/participation/committee

So, can java programmers progarm in c# and vice versa? Yes.