Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is .NET/Mono or Java the better choice for cross-platform development? [closed]

How much less libraries are there for Mono than for Java?

I lack the overview over both alternatives but I have pretty much freedom of choice for my next project. I'm looking for hard technical facts in the areas of

  • performance (for example, I'm told Java is good for threading, and I hear the runtime code optimization has become very good recently for .NET)
  • real world portability (it's both meant to be portable, what's Catch-22 for each?)
  • tool availability (CI, build automation, debugging, IDE)

I am especially looking for what you actually experienced in your own work rather than the things I could google. My application would be a back-end service processing large amounts of data from time series.

My main target platform would be Linux.

Edit: To phrase my question more adequately, I am interested in the whole package (3rd party libraries etc.), not just the language. For libraries, that probably boils down to the question "how much less libraries are there for Mono than for Java"?


FYI, I have since chosen Java for this project, because it seemed just more battle-worn on the portability side and it's been around for a while on older systems, too. I'm a tiny little bit sad about it, because I'm very curious about C# and I'd love to have done some large project in it, but maybe next time. Thanks for all the advice.

like image 786
Hanno Fietz Avatar asked Sep 14 '08 19:09

Hanno Fietz


People also ask

Why. NET Framework is not cross-platform?

The main problem is that the implementations can differ from each other, making it hard to run an application on multiple machines out of the box. Source code shouldn't have to be altered, if not some of the libraries are not ported to mono, or different libraries are used.

Is .NET cross-platform?

NET is a free, cross-platform, open source developer platform for building many different types of applications. With . NET, you can use multiple languages, editors, and libraries to build for web, mobile, desktop, games, IoT, and more.

Is Java truly cross-platform?

Yes, Java is cross-platform - or, more accurately, portable. It runs on the most used architectures and platforms, often without modification, which makes it one of the most portable languages out there.

Is .NET Core truly cross-platform?

NET Core is cross-platform. It runs on Windows, OS X and multiple distributions of Linux. It also supports different CPU architectures.


1 Answers

Mono does a better job at targeting the platforms I want to support. Other than that, it is all subjective.

I share C# code across the following platforms: - iOS (iPhone/iPad) - Android - The Web (HTML5) - Mac (OS X) - Linux - Windows

I could share it even more places: - Windows Phone 7 - Wii - XBox - PS3 - etc.

The biggie is iOS since MonoTouch works fantastically. I do not know of any good way to target iOS with Java. You cannot target Windows Phone 7 with Java, so I would say that the days of Java being better for mobile are behind us.

The biggest factor for me though is personal productivity (and happiness). C# as a language is years ahead of Java IMHO and the .NET framework is a joy to use. Most of what is being added in Java 7 and Java 8 has been in C# for years. JVM languages like Scala and Clojure (both available on the CLR) are pretty nice though.

I see Mono as a platform in it's own right (a great one) and treat .NET as the Microsoft implementation of Mono on Windows. This means that I develop and test on Mono first. This works wonderfully.

If both Java and .NET (Mono let's say) were Open Source projects without any corporate backing, I would choose Mono over Java every time. I believe it is just a better platform.

Both .NET/Mono and the JVM are great choices, although I would personally use some other language than Java on the JVM.

My take on some of the other comments:

Issue: Performance.

**Answer: Both the JVM and the CLR perform better than detractors say they do. I would say that the JVM performs better. Mono is generally slower than .NET (though not always).

I personally would take ASP.NET MVC over J2EE any day both as a developer and an end-user. Support for Google Native Client is pretty cool too. Also, I know that poor GUI performance for desktop Java apps is supposed to be a thing of the past but I keep finding slow ones. Then again, I could say the same for WPF. GTK# is plenty fast though so there is no reason they have to be slow.

Issue: Java has a larger ecosystem of libraries available.

Answer: Probably true, but it is a non-issue in practice.

Practically every Java library (including the JDK) runs just dandy on .NET/Mono thanks to IKVM.NET. This piece of technology is a true marvel. The integration is amazing; you can use a Java library just like it was native. I have only had to use Java libraries in one .NET app though. The .NET/Mono ecosystem generally offers more than I need.

Issue: Java has better (broader) tools support

Answer: Not on Windows. Otherwise I agree. MonoDevelop is nice though.

I want to give a shout-out to MonoDevelop; it is a jewel. MonoDevelop integrates most of the tools I want use including code completion (intellisense), Git/Subversion integration, support for unit tests, SQL integration, debugging, easy refactoring, and assembly browsing with on-the-fly decompilation. It is wonderful to use the same environment for everything from server-side web to mobile apps.

Issue: Compatibility across platforms.

Answer: Mono is a single code-base across all platforms, including Windows.

Develop for Mono first and deploy to .NET on Windows if you like. If you compare .NET from MS to Java though then Java has the edge in terms of consistency across platforms. See next answer...

Issue: Mono lags .NET.

Answer: No it does not. IMHO, this is an often stated but incorrect statement.

The Mono distribution from Xamarin ships with C#, VB.NET, F#, IronPython, IronRuby, and I think maybe Boo out of the box. The Mono C# compiler is completely up to date with MS. The Mono VB.NET compiler does lag the MS version. The other compilers are the same on both platforms (as are other .NET languages like Nemerle, Boo, and Phalanger (PHP) ).

Mono ships with a lot of the actual Microsoft written code including the Dynamic Language Runtime (DLR), Managed Extensibility Framework (MEF), F#, and ASP.NET MVC. Because Razor is not Open Source, Mono currently ships with MVC2 but MVC3 works on Mono just fine.

The core Mono platform has kept pace with .NET or many years and the compatibility is impressive. You can use the full C# 4.0 language and even some C# 5.0 features today. In fact, Mono often leads .NET in many ways.

Mono implements parts of the CLR spec that even Microsoft does not support (like 64 bit arrays). One of the most exciting new pieces of technology in the .NET world is Rosylyn. Mono has offered the C# compiler as a service for many years. Some of what Rosylyn offers is available via NRefractory as well. An example of were Mono is still ahead would be the SIMD instructions to accelerate gaming performance.

Microsoft does offer a number of products on top of .NET that are not available in Mono which is were the misconception about Mono lagging comes from. Windows Presentation Foundation (WPF), Entity Framework (EF), WCF (Windows Communication Foundation) are examples of products which do not work, or are poorly supported, on Mono. The obvious solution is to use cross-platform alternatives like GTK#, NHibernate, and ServiceStack instead.

Issue: Microsoft is evil.

Answer: True. So what.

Many people offer the following reasons to avoid using Mono:

1) You should not use Mono because Microsoft tech should be avoided

2) Mono sucks because it does not let you use every technology that Microsoft offers

To me, it is clear that these statements are incompatible. I reject the first statement but will skip that argument here. The second statement is true of all .NET alternatives.

The JVM is a great platform and the explosion of JVM languages is awesome. Use what makes you happy. For now, that is often .NET/Mono for me.

like image 161
Justin Avatar answered Sep 30 '22 17:09

Justin