LWN.net Logo

Livnat Peer: Switching from C# to Java

Livnat Peer looks at porting a C# application to Java. "In 2008 RedHat acquired Qumranet, a startup whose focus was Virtualization. Among other products Qumranet developed a management application for Virtualization. The management application was written in C# and one of the first tasks we got was to make the management application cross platform, well this was expected considering the fact that the acquisition was done by RedHat... We started exploring the web looking for ideas how to approach this task. At the beginning things did not look promising most of the references we found for porting projects from one technology to another were about complete failures, the only obvious suggestion that we saw all over was not to change technology and architecture at the same time."
(Log in to post comments)

Livnat Peer: Switching from C# to Java

Posted Apr 13, 2010 9:50 UTC (Tue) by HelloWorld (guest, #56129) [Link]

If anything, I'd port stuff to C#, not from C# to Java. Java as a language just sucks too hard to use it for, well, anything really.

C# is hopeless...

Posted Apr 13, 2010 10:13 UTC (Tue) by khim (subscriber, #9252) [Link]

Care to elaborate? Only before you do please take look on the top left corner of the page: if your point is not with Java vs C# but with .NET vs J2EE then you are on the wrong site altogeter.

C# is hopeless...

Posted Apr 13, 2010 12:27 UTC (Tue) by Cyberax (subscriber, #52523) [Link]

Compare data access with LINQ and Java. JDBC in Java is not even close to LINQ's capabilities.

For example, I can use the same query both for unit tests on in-memory collections and with production database. All statically checked (so if a field is renamed in DB, I get a compile-time error).

As for GUI - don't even try to compare WPF and Swing.

C# is hopeless...

Posted Apr 13, 2010 12:40 UTC (Tue) by ceplm (subscriber, #41334) [Link]

Take one more look to the top left corner and consider that the blog post was written by Red Hat employees. WPF won't fly far here.

C# is hopeless...

Posted Apr 18, 2010 0:25 UTC (Sun) by salimma (subscriber, #34460) [Link]

Java as a language has not been keeping up with the times, but the good news is you can write apps for the JVM with Scala, Clojure, or other JVM languages. The former has several wonderful LINQ-like data access libraries (of which Squeryl is the most mature. Note I say libraries -- no language extension needed), the latter is *the* Lisp to have for concurrent programming.

Nothing wrong with Swing, especially if you use Netbeans and its wonderful visual editor.

C# is hopeless...

Posted Apr 13, 2010 13:04 UTC (Tue) by HelloWorld (guest, #56129) [Link]

Oh come on. Why do you want me to repeat what dozens of other people have written down already?

Just read this:
http://en.wikipedia.org/wiki/Comparison_of_Java_and_C_Sharp
C# is so much more pleasant to write that it's downright embarassing for Java.

Scala >>> Java

Posted Apr 16, 2010 18:00 UTC (Fri) by jonabbey (subscriber, #2736) [Link]

Yup. I'm leaning strongly to doing all new JVM work with Scala rather than Java for this reason.

Not just a language choice

Posted Apr 13, 2010 15:19 UTC (Tue) by markmc (subscriber, #34182) [Link]

Exactly, the JBoss/J2EE/Java platform is the natural choice for Red Hat building an application like this. It's a platform choice, not just a language choice.

Livnat Peer: Switching from C# to Java

Posted Apr 13, 2010 12:15 UTC (Tue) by DOT (subscriber, #58786) [Link]

Works fine for me.

Livnat Peer: Switching from C# to Java

Posted Apr 13, 2010 12:43 UTC (Tue) by epa (subscriber, #39769) [Link]

I believe they did try running the existing C# code under Mono but found the runtime was 'immature'. It's not quite clear what this means (or that fixing the issues wouldn't have been less work than porting the whole thing to Java) but it makes some sense: Sun's JVM is now a mature program which has seen lots of optimization and scalability work, while Mono's virtual machine is younger and still evolving at a fast pace.

As usual, language wars are not the deciding factor but more mundane considerations of how good the platform, libraries and toolchain are.

(I wonder if the Java port they've written works under Mono using IKVM...)

Livnat Peer: Switching from C# to Java

Posted Apr 13, 2010 13:07 UTC (Tue) by HelloWorld (guest, #56129) [Link]

There is a word for calling stuff "immature" without giving specific reasons. It's called trolling, and it's sad that Red Hat does it.

Livnat Peer: Switching from C# to Java

Posted Apr 13, 2010 14:34 UTC (Tue) by vonbrand (subscriber, #4458) [Link]

Oh, come on. This is one of the many alternatives considered, several others did get an even more cursory dismissal.

Livnat Peer: Switching from C# to Java

Posted Apr 13, 2010 17:01 UTC (Tue) by gouyou (subscriber, #30290) [Link]

It's called trolling, and it's sad that Red Hat does it.
No, no, no! You should have writen:
It's called trolling, and it's sad that I do it.

Livnat Peer: Switching from C# to Java

Posted Apr 13, 2010 13:16 UTC (Tue) by Cyberax (subscriber, #52523) [Link]

Mono is crap.

We've evaluated it and found a LOT of unimplemented features in everything straying even a step away from core libraries.

Also, their runtime is still quite slow. For example, they STILL use a conservative non-compacting GC.

Livnat Peer: Switching from C# to Java

Posted Apr 13, 2010 13:29 UTC (Tue) by SEJeff (subscriber, #51588) [Link]

How about their JIT regex engine that is faster than libpcre? Get the facts straight before posting FUD please.

Livnat Peer: Switching from C# to Java

Posted Apr 13, 2010 14:03 UTC (Tue) by Cyberax (subscriber, #52523) [Link]

Great! Thanks!

Now I'm going to rewrite all my programs as a large strings and use Mono regex engine as an emulator of Markov machine. You're genius!

Livnat Peer: Switching from C# to Java

Posted Apr 13, 2010 15:07 UTC (Tue) by rwmj (guest, #5474) [Link]

You owe me a cup of a tea and a keyboard :-)

Livnat Peer: Switching from C# to Java

Posted Apr 13, 2010 13:57 UTC (Tue) by epa (subscriber, #39769) [Link]

You're right that the current Mono garbage collector is not that great. Work is progressing to include a better one in the next release.

Livnat Peer: Switching from C# to Java

Posted Apr 13, 2010 14:08 UTC (Tue) by Cyberax (subscriber, #52523) [Link]

I've written a quite advanced GC for an embedded implementation of a JVM.

I can say, that Mono is years away from a good GC. Their SGen-GC is a joke, it's NOT an exact GC - they still treat some memory conservatively (stack and registers). And even a few pinned objects make impossible a LOT of optimizations.

To be fair, the current MS .NET runtime has a fairly mediocre GC. But at least it's an exact GC.

Livnat Peer: Switching from C# to Java

Posted Apr 13, 2010 15:56 UTC (Tue) by bronson (subscriber, #4806) [Link]

It also makes sense to be worried about Mono's long-term future. If Novell (or maybe just Miguel!) gets bored, Mono development will slow significantly.

If I was planning 5 years out for a commercial project I would definitely choose one of its many alternatives!

Livnat Peer: Switching from C# to Java

Posted Apr 14, 2010 14:28 UTC (Wed) by sharms (subscriber, #57357) [Link]

I have found most people who are proficient programmers rarely assert the virtues of one language over another, because it doesn't matter.

People who get caught up in this argument just want a language to blame for their lack of skill in language 'x'.

Livnat Peer: Switching from C# to Java

Posted Apr 14, 2010 14:55 UTC (Wed) by Cyberax (subscriber, #52523) [Link]

Yeah. Let's all write in COBOL! After all, expressiveness doesn't matter.

PS: for the record, I know JVM inside out (really, from assembly instructions used for write barriers), also I know enterprise technologies (EJB3, distributed transactions, etc.) as well. I think that's a pretty advanced level. So I think I'm qualified to compare C# and Java.

Livnat Peer: Switching from C# to Java

Posted Apr 14, 2010 18:42 UTC (Wed) by HelloWorld (guest, #56129) [Link]

That's just a load of bullshit. A programming language is a tool, and while it's possible to build stuff without a power drill, nobody would claim that power drills "don't matter", because they obviously do increase productivity.

Also, i have found that most people who claim that programming languages "don't matter" simply don't have a clue about them. Modern type systems can do a *lot* more than most people realise. NULL pointer dereferences in Haskell are impossible, because there are no NULL pointers (and it turns out they're not needed). Dependent types have the potential to make out of bounds array accesses a thing of the past. And most important of all, a good programming language will change the way you think by giving you other means to express what you think. Expressing what you think is the single most important thing in human life. It's what sets humans apart from animals, and thus using a language that forces one to make compromises in that area is not worth using.

Furthermore, there are quite a lot of people whom i consider proficient programmers who do worry about programming languages. One of them is Paul Graham, who wrote this insightful article: http://www.paulgraham.com/avg.html

Only animals program in Java (etc.)

Posted Apr 14, 2010 21:38 UTC (Wed) by tialaramex (subscriber, #21167) [Link]

"It's what sets humans apart from animals"

Any time someone says this you can immediately guess that they don't know anything about animals OR humans.

Livnat Peer: Switching from C# to Java

Posted Apr 16, 2010 0:00 UTC (Fri) by Cyberax (subscriber, #52523) [Link]

"NULL pointer dereferences in Haskell are impossible, because there are no NULL pointers (and it turns out they're not needed)."

Haskell has the 'Maybe' monad which is essentially the same thing.

Livnat Peer: Switching from C# to Java

Posted Apr 16, 2010 0:20 UTC (Fri) by HelloWorld (guest, #56129) [Link]

Oh no, it's not. In C *every* pointer might be null, while in Haskell you don't use "Maybe" 99% of the time. The second difference is that you can't use a Maybe value directly, you have to extract the actual value from the Maybe by pattern matching. The compiler can then do exhaustiveness checking and tell you at compile time that you forgot to check for Nothing values.

Livnat Peer: Switching from C# to Java

Posted Apr 14, 2010 8:03 UTC (Wed) by tarjei (subscriber, #29357) [Link]

I'm quite amazed at the process they used. Converting the application not by rewriting but by translating it from one language to another is quite impressive - and interesting.

Livnat Peer: Switching from C# to Java

Posted Apr 14, 2010 16:46 UTC (Wed) by felixrabe (guest, #50514) [Link]

I once ported some 1000 lines of C# code using Python regex to Matlab. Was quite a bit of fun.

Livnat Peer: Switching from C# to Java

Posted Apr 17, 2010 12:21 UTC (Sat) by Lovechild (subscriber, #3592) [Link]

Red Hat, big investors in Java and spreaders of Mono FUD elect to publicly talk about the virtues of Java over C# as well as taking yet another chance to call Mono crap without giving specifics or bug reports.

Water wet, sky blue.. news at 11. *yawn*

The only surprising bit was that at least this article didn't contain "Mono is known to infringe on patents, I just refuse to actually name them" as one has come to expect from RH.

Copyright © 2010, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds