tags:

views:

403

answers:

9

Possible Duplicate:
Is it worth learning Java when you already know C# fairly well?

I have been working on the .net framework for the past 5 years. Does it make sense to learn Java. Aren't both the Java and C# language / runtime / libraries meant for general purpose programming? How do they differentiate themselves?

I guess what I am trying to figure out is, if I had a chance to do it over again, why would I chose one over the other?

Please do not close the question as argumentative.

I am curious to know what advantage Java (language/library/runtime) has over C#(language/.net runtime/.net libraries) and vice versa.

+1  A: 

You can always start from the Wikipedia entry on the matter.

Kensai
Both the languages overlap pretty closely on their feature set, their implementations may be different, but as a programmer I can do the same thing in either of the languages
Nick
Since both are very similar, I would consider one language over the other for their framework (JVM over .NET) and not their inherent feature set.For example, if you like Scala you would definitely prefer Java since the .NET bindings for Scala are not updated so often.
Kensai
+2  A: 

The primary factor is the platform and technology infrastructure you have in place. If you are a Linux/Sun/Oracle/Open source/... shop, you'd naturally with Java and if you're a Windows shop, you'd choose .NET.

Mehrdad Afshari
So it has to do with going for the "open source" philosophy?
Nick
Not really. Might be the case if you have full control on your choice, but for most real business applications, you are hardly the first guy to set up the infrastructure. There are usually working systems in place that pretty much dictate what to do. That said, I'd always choose .NET if I could choose! ;)
Mehrdad Afshari
there's also Mono for Linux. it can run .NET programs.
cd1
CD1: Yes, but I have yet to see a serious business (which is not in IT itself) to take that risk.
Mehrdad Afshari
Mono can NOT run .net programs, but only the ones that limit themselves to certains part of an older api release.
nxadm: Futher more, .NET may not run all the MONO programs, specially if they use MONO specific libraries like Mono.Unix; http://bit.ly/50RKw
OscarRyz
+4  A: 

I have recently switched from using only Java (college) to using strictly C# (Work). I have found the switch to be almost trivial.

There is almost no difference between the two languages.

I will say that I like C# better. It seems to have a much better/fully developed library.

The only thing that I found to be non-trivially different between the two languages are things like delegates and lambdas in C#. That has been the hardest thing for me to get used to.

jjnguy
I'm not a C# developer and I'm curious what you mean by the C# library being better / more fully developed.
Jherico
"The only thing that I found to be non-trivially different between the two languages are things like delegates and lambdas in C#. That has been the hardest thing for me to get used to." By that statement, do you mean the concepts are hard to understand, or do you mean that the language implements it in a confusing way? The fact that C# provides them while (I think?) Java does not sounds like a point in C#'s favor.
dss539
@Jherico It seems like lots of little things in the .net libraries are better. DateTime, Path and file and directory things. It is not a huge difference, but I think it is noticeable.
jjnguy
@dss539 The concepts are much more confusing to adapt to than any of the other differences in the C# language. The fact that C# has them though is definitely a point in C#'s favor though.
jjnguy
+1 for saying C# is better ;)
Matthew Whited
+6  A: 

Answering "Does it make sense to learn Java?": I would have to say no, unless you have a specific reason to be working in java.

While I believe that a programmer should always continue learning new languages, Java and C# are too similar.

I see new languages as new tools, so what you really need is languages that differ in their style. Continuing the analogy, knowing C# and learning Java is like buying a second saw when you still don't have a hammer. It may cut better than your other saw, but you're still going to have a hard time pounding in a nail.

As a C#/javascript/python programmer, I have recently looked into languages such as F# and c (ansi), with the goal to know a wide range of styles, therefore allowing me to see a problem from different angles.

chills42
Most of the people I have spoken to in person share this same exact point of view.
Nick
+4  A: 

C# support is pretty poor on non-windows OSes.

Mono is getting better and better, but it's still not quite there yet.

The C#->Java transition is so trivial, that it's probably not really worth your time unless you actually need to use it for something. If you are just hankering for a new language to learn, Python or Ruby would be my suggestion.

biggusjimmus
A: 

simply there is no difference. the big one it's where the money goes in.

ZeD
Your assuming there is a cost to going to either one. The entry cost for programming on either platform may be free and it may be very expensive.
Matthew Whited
no. I'm not assuming programmers must pay for one of the platforms.What I'm saying it's that the value of a platform (in this case Java/J2e/... vs C#/.NET/...) *depends on how many programmers use it*.
ZeD
+4  A: 

Disclaimer: I've done some work in both environments, but I definitely have more experience and in-depth knowledge in the .NET arena.

I'd say the stacks have many similarities, and their overall direction seems to plot along with the general direction of computer science as a whole. For example, both have been adding VM capabilities to support dynamic languages lately, which has allowed for dynamic languages to start showing up on both platforms.

What's most different is the ecosystems that surround the platforms. Java's community is largely open-source driven and while major commercial entities still actually push the platform forward, it's at least a consortium of them, instead of a single company driving the platform like in the Microsoft space.

Because the OSS community is so prevalent in the Java space, the Java stack typically moves forward with new ideas a bit faster than .NET. Things like dynamic languages on the Hotspot VM and even old technologies like web frameworks employing MVC are typically much farther along than they are in the Microsoft world. That's not to imply that .NET doesn't have successful OSS projects, but many of the most popular are in fact ports of Java projects (NHibernate, Lucene.NET, etc). Additionally, a lot of the .NET advocates and experts are the Microsoft MVP crowd who make a living selling books and speaking engagements and typically track along with Microsoft product roadmaps. I'm not arguing that they are all shills for the company, but simply that innovation in the .NET ecosystem that doesn't come from Redmond is much rarer than it is in the Java space.

So, while you could argue that learning Java syntax may not be worth the time (since it's so close to C# in so many cases) I find it personally rewarding to keep up with the Java community (as well as others, like Ruby) as it's one way to glimpse the future and generally make you a better developer. Even if you're not writing Java code but simply paying attention to Java podcasts or blogs, you're likely to learn some new technique or technology that may prove to be relevant.

krohrbaugh
@krohrbaugh: so true.
Syed Tayyab Ali
+1 very thoughtful.
Nick
+2  A: 

I'm more of a Java developer and have used C# in the past. The languages are almost identical with a few minor differences in both. I use C# when I know the application I have to write will be desktop GUI intensive and Windows based since Visual Studio makes it a breeze.

If I have to write anything that doesn't require a GUI, anything that needs to be multi-platform I stick with Java since it's extremely portable.

For web based apps I think PHP is the way to go but that's just my opinion. :)

Peter D
+1 for stating your opinion... even if it is wrong ;)
Matthew Whited
A: 

Well, there's some new interesting stuff if you moved from Java -> C#, so it might be worth it from a new language constructs perspective, but the other way around, from C# -> Java, not so much.

JulianR