问题
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?
回答1:
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
回答2:
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.
回答3:
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.
回答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.
回答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
回答6:
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.
回答7:
Make sure you have tons of tests, because such a migration will bite you where you expect it least.
回答8:
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.
回答9:
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.
回答10:
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.
回答11:
If it is decided to do this, you will most likely benefit from a hybrid approach where you can basically mix C# and Java in the same application, as it will change the scenario from a waterfall conversion to a gradual migration. Here I know of two possibilities:
1) ikvm (http://www.ikvm.net/) which allow you to run Java code in a .NET-runtime. This allows the Java code to call the C# code and vice versa. Then you can freeze the C# code development, and slowly add the revised functionality to the Java part while keeping a functional application.
2) Mainsoft (http://dev.mainsoft.com/Default.aspx?tabid=130) which allows you to compile .NET-bytecode into Java bytecode. They have a free entry version. I have no experience with the product, but they advertise heavily on our platform which only has Java available.
回答12:
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.
回答13:
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...
回答14:
Possibly you could use jni4net - opensource bridge ? Or list of other options I know.
来源:https://stackoverflow.com/questions/740625/migrating-a-project-from-c-sharp-to-java