Migrating a project from C# to Java
Asked Answered
N

14

13

With some changes in the staffing at the office, the levels of C# expertise has dropped off precipitously and there are now more Java developers. It has gotten to the point where the higher-ups are considering moving an existing .NET project written in C# into the Java world.

Aside from the obvious problem of starting completely from scratch what are the possible ways that this company can accomplish a successful move of development on a project from .NET C# into Java?

Nuriel answered 11/4, 2009 at 19:1 Comment(0)
M
21

Here are things to consider:

  • Is this big project? If Yes, try to stick with C#
  • Is this medium sized project with components? If No, try to stick with C#
  • Is this small project meant to be deployed on windows only? If yes, try to stick with C#
  • Is this old source code? If Yes, try to stick with C#
  • Do you use windows OS specific APIs? If Yes, try to stick with C#
  • Do you use any third party APIs without Java counterpart? If Yes, try to stick with C#
  • Do you use .Net in "deep"(data binding, User controls etc.)? If yes, try to stick with C#
  • Migration time is more acceptable than getting new/converted C# guys? If no, try to stick with C#
  • Do you think end users will not be receptive of changes, if you are to use Java framework which will change presentation? If yes, try to stick with C#
  • Check commercials

If you decide to convert:

  • Go per component
  • Go per layer
  • Have lots of tests
  • Check if there are tools to help (however small help may be) with migration
Mantilla answered 11/4, 2009 at 19:36 Comment(2)
why does "# Is this small project meant to be deployed on windows only? If yes, try to stick with C#" matter? I think that you missed: is it a gui? try to stick with c#Paulita
If it is small project, then it is not worth to convert to Java when there are few C# programmer still available. But if it is needed to run on different OS, then it is worth to convert. I think, GUI point is covered under change in presentation and win API calls.Mantilla
M
15

Just to add to Brian and Eric's opinions, I would say that picking up C# for a Java developer should be straightforward in my opinion. They are conceptually very similar languages and I would suggest training your Java developers to gain some C# skills so you won't be forced to go to the hassle of a migration process.

Mineraloid answered 11/4, 2009 at 19:17 Comment(0)
R
6

I subscribe to Joel's view that a total rewrite is almost always a mistake. Other posters are right: C# and Java are similar enough that any competent Java developer should be able to become competent in C# in a matter of weeks or months. That's not to say they will be experts. That takes longer but as long as you have some C# developers who can guide the process then you should be OK.

It's hard to comment on whether or not such a transition is a good or bad idea without knowing specifics of your application: size, type of application, industry and so on.

I would be extremely reticent about such a switch because, in my humble opinion, C# is now a much more modern language than Java and I say this to you as someone who has been a Java developer ofr over a decade (since the 1.0.2/1.1 days).

That's not to say that Java is bad. It's not. Sun does have a cloud hanging over it and demonstrated an unwillingness or inability to drive the platform forward in recent years.

Rocket answered 12/4, 2009 at 0:27 Comment(0)
V
5

Before you finish converting the .NET project into Java, all those Java developers who were part of the conversion project will have learned C#. So then you don't anymore need to convert it to Java (and you can throw away all Java code which was produced in the conversion), because now you have a development team which can do both Java and C#. Problem solved. :D

Valaree answered 11/4, 2009 at 20:54 Comment(0)
A
4

Regardless of the languages involved, the management of this company sounds insane. For anything other than a trivial application, how can it be economically sensible to rewrite an entire code base from scratch instead of just hiring a single person with some skills in the right language? Is this a business with that well-known problem: too much spare cash?!

How long has the existing code been in development? If it's barely started, I could understand this. If it's seen a release and has active users, it will never make sense to throw it away. If you donated the C# code to a start-up with the right skills, think how much of a head start they would have over you.

Acrefoot answered 11/4, 2009 at 20:26 Comment(0)
C
3

Have a look at Net2Java, which puports to assist in converting your code from C# to Java. I doubt it'll be perfect, but its one way to remove a lot of drudgery from the task, leaving you with the kinks of incompatible framework calls and language features to iron out.

Once you've done that, your task is like any other large migration project - test, test and test again. Unit tests, System integration tests, then end-user tests. You should havew those tests already in place that you used with the original application, apart from the unit tests, they will still be relevant.

Cusco answered 11/4, 2009 at 19:48 Comment(0)
C
2

If there are any components that are already isolated or any of it uses a service-oriented architecture, you could conceivably migrate one component at a time (where each individual component is a rewrite) and still have the components talk to one another using the same interoperable network protocols. Probably depends on what type of app we're talking about.

Commutation answered 11/4, 2009 at 19:4 Comment(0)
D
2

Make sure you have tons of tests, because such a migration will bite you where you expect it least.

Ddene answered 11/4, 2009 at 19:10 Comment(0)
O
1

Do you have more .Net or more Java applications in production. If your already have a substantial investment in .Net servers and applications, why not ask for volunteers among the Java developers to move to .Net? The language and syntax is very similar, so the hard part would be learning the framework and unless they would spend all their time doing UI development even learning the framework is not that hard.

In our office we have a number of very good developers who move back and forth between Java and .Net as needed.

Ogpu answered 11/4, 2009 at 19:16 Comment(0)
C
1

I am not a Java expert, but from my experience working with Java code whilst being a C# fan, the following are some of the possible headaches:

  • Generics are implemented differently in Java and C#.
  • Boxing/Unboxing behaviors are different between Java and C#
  • Java class naming convention + lots C# generated code
  • String handling (i.e. Unicode/ASCII concerns) can be problematic depending on the quality of Java/C# code being ported over.

Personally, I don't think writing from scratch is a bad idea at all. Since you already have a working architecture.

Codie answered 11/4, 2009 at 19:37 Comment(0)
W
1

In order to prove to management, you always needs to talk in terms of ROI and numbers. Show them that if you move these applications, it will take tremendous amount of time, QA resources, and can easily take a back seat if it gets de-prioritized due to some other project or new development taking importance.

I had success when I showed them the timelines, ROI, work involved, money involved, etc.

So now coming to the actual point, I do think Java developers would be able to support C# unless they have some fundamental mental block against Microsoft technolgies.

Whereon answered 11/4, 2009 at 19:48 Comment(0)
R
1

Possibly you could use jni4net - opensource bridge ? Or list of other options I know.

Relict answered 14/12, 2010 at 0:9 Comment(0)
K
0

I'm somewhat surprised noone even suggested the idea of rejecting migration.

I do not believe a C# developer can be forced to switch to Java (or vice versa) because he was told to (well, if he's threatened with a gun then maybe). I takes much time, exercise and passion to master at least one technology stack. You just can't start overnight with a new technology and expect to provide the same quality.

I'd personally not bother until told to start migration. At which point I'd tell the manager that I'm .NET guy and won't switch to another technology just because they decided to.

As for the technical side, it's not the language syntax that differs but rather libraries and their features. Of course, if all the latest bells and whistles of .NET 3.5 have been extensively in use then the language difference will provide you with a real challenge.

That's certainly a funny way, just decide to migrate applications from .NET to Java. Someone has no idea of the hassle involved...

Keyte answered 11/4, 2009 at 20:17 Comment(2)
you do what your boss tells you, there's plenty of unemployed devs out there willing to code in whatever is required. If you owned the business, then it'd be different.Cusco
If the boss decides they want all apps to be in Java so he doesn't have to have specialist programmers in multiple languages then you have to understand that there is a big advantage to be gained when everyone speaks the same language and anyone can work on any piece of code in the company. I remember once place I worked which was a Java shop with one piece of code that was in C# - the one C# dev they had left and then no one wanted to touch that piece of C# code for years.Herod
H
0

I realize that this is an old question but to anyone else going down this path, you could try this open source C# to Java Converter:

http://www.cs2j.com/

Herod answered 25/3, 2021 at 5:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.