To me it seems these are two different platforms that address similar enterprise(but not only) problems. I'm interested however in problems that Java can solve better than C#/.NET or C#/.NET can solve better than Java. Leaving aside the 'cost' factor, since that is somehow not an issue for big enterprise companies (the developers probably cost more than the licenses from Microsoft - it's just a thought) and even for small projects there are free/open-source tools for .NET so the cost can be zero for the .NET world as well. With Mono, you can port .NET to Linux and MacOS as well so the benefit that Java had(cross platform) isn't THE decision factor to use Java nowadays..

What real world problems can you think of where .NET would be a much better solution than Java, and vice-versa? I'm only interested in solutions to problems.

5 Answers
5

There are some language features in C# (4/5) such as LINQ, using predicate and some functional aspects that many would argue place it ahead of Java 6 in terms of productivity/flexibility (YMMV on that). Others would argue that C# is becoming a big cesspit of every brand new idea that happens to be popular and it's getting harder to wield effectively (YMMV on that).

Some will also argue that the Java eco-system is far more flexible and that the JVM is probably the most capable and flexible runtime around (if you look at the various languages that run on the JVM adn their interoperability with Java). Again YMMV.

What it really boils down to is the quality of the developer(s) who are designing and writing the code. .NET and the Java eco-system are so close in capabilities that its usually the developer that makes a difference.

From a systems integration flexibility aspect, yes Java still has an edge there. Cross platform is still an issue - many enterprises will see using Mono as risky (again YMMV here) and there are some systems that Mono won't run on that have JVMs (Some older big IBM machines for example). Java has also been around a bit longer and has that established 'trust' in enterprises, it's not easy for .NET to gain that trust at say a mega-bank.

Meh - I conclude with no real conclusion, which I think mirrors the fact that Java and .NET are neck and neck these days.

@Maxtor. We deploy to an IBM platform (IBM i to be precise) which does not run Windows or Unix. IBM does not provide .NET or Mono for this platform, but they do provide a Java implementation.
–
user1249Dec 3 '10 at 17:23

I don't think there is any class of problem domain that begs for one or the other. Some platforms can't run .NET, such as certain smart phones and so J2ME has some more portability.

In the enterprise space, I usually see this decision based on the experience of the team, or if its a new group/project then the experience of its initial managers.

In my team, we have a lot of both .NET and J2EE. This is mostly for the reason that there are different strengths in terms of the existing open source projects we can use; and we have vendor runtime platforms that require one or the other. We do all our UI work in .NET; most of our integration and search platform is hosted on Java. Our middleware is a mixed bag. I'm sure this horrifies some people but it really gives us a lot of flexibility and saves us a lot of time in the end because we can leverage the best products in their problem domain, not just on our platform.

If you're concerned with smart phone programming, Android runs Java, not C#. Windows phones will run Microsoft's dev tools, but Android already has huge market share and it remains to be seen whether or not Windows 7 phones can grab a significant piece of the pie for themselves. With Microsoft behind them you can never count them out because of their incredible resources. However, until there is even some degree of parity between those two phone platforms, if you want to do Android phone programming you have to choose Java. Since Objective-C/Cocoa development was not part of the question I left iPhone development out of my post.

For completeness I should point out the existence of the MonoDroid project that allows you to use .NET tools for Android applications: