views:

129

answers:

2

I am curious as to how people port open source projects such as Lucene and Hibernate from Java to .NET? Is it a simple matter of using the Java Language Conversion Assistant 2.0 released by Microsoft?

+10  A: 

Unfortunately, there's usually a much greater effort involved for projects that large. What's efficient in one language may not be in another, and more importantly what exists in one language may not in another. NHibernate for example took years to port over, and they're still doing it (albeit adding features the whole time, like Linq).

It's usually a matter siting down and porting classes one by one, optimizing where possible, changing structures where needed. Things like generics, aliases and boxing all change in the port. Then, after you get it all over, there's often lots of optimization still left to be done (of course this is optional...), maybe it's events, maybe it's statics and extension methods, could be anything your new language/platform offers that the old one didn't.

Think of it this way, why are you porting it to .Net? I'd wager to say you're in one of two situations, one you're stuck using .Net because of work (doh, sorry!) or you like .Net because it offers you some advantage. In the second category that means you chose it over Java, so in porting you'd want to take advantage of whatever features that made you choose .Net in the first place.

Nick Craver
@Nick thanks for your answer. Happily I'm not porting anything from Java to .NET (or vice versa) but have always been curious on how it was done. What’s obvious from your answer is that it’s a long process with a large time investment and those who port from one language to another deserve far more recognition than what they get.
Kane
@Kane - There's one other factor along those lines, how much whoever doing it **cared** about it (and, to a certain degree knew about the destination framework, the more you know the better/faster you can make it). There's the quick and dirty no optimization port, then there's beautiful ports that take full advantage of the language/framework...those take much more time but are tremendously useful to the community.
Nick Craver
+4  A: 

Like Nick said it is not that simple. A lot more than just porting code is involved, especially if the architecture of the application you want to port isn't that great. You want to use the features of the language you are porting to, and sometimes they are design decisions that you might change, because they don't seem right to you. I am not going to reiterate what Nick said, but would like to add the following.

I would recommend following the development of Noda Time, which is Jon Skeet's attempt to port Joda Time from Java to .Net. Jon is actually documenting the experience on the following blog:

http://noda-time.blogspot.com/

I would recommend following the blog, the google groups page for this project, and google code project. The google groups and code page links can be found on one of the posts on the blog.

Waleed Al-Balooshi
+1 for John Skeet.You can take his words as gospel truth. :)
Srinivas Reddy Thatiparthy
One of the best examples possible, Jon knows about the framework better than most and you can see what a proper port looks like, taking advantage of the destination's features. +1 Waleed
Nick Craver