将项目从 C# 迁移到 Java

发布于 2024-07-16 07:52:10 字数 261 浏览 4 评论 0原文

随着办公室人员配置的一些变化,C# 专业知识水平急剧下降,现在有更多的 Java 开发人员。 高层正在考虑将现有的用 C# 编写的 .NET 项目迁移到 Java 世界。

除了完全从头开始这个明显的问题之外,还有什么该公司可以通过哪些方式成功地将项目开发从 .NET C# 迁移到 Java?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(14

最近可好 2024-07-23 07:52:10

以下是需要考虑的事项:

  • 这是一个大项目吗? 如果是,请尝试坚持使用 C#
  • 这个中型项目是否包含组件? 如果否,请尝试坚持使用 C#
  • 这个小项目是否只能部署在 Windows 上? 如果是,请尝试坚持使用 C#
  • 这是旧源代码吗? 如果是,请尝试坚持使用 C#
  • 您是否使用 Windows 操作系统特定的 API? 如果是,请尝试坚持使用 C#
  • 您是否使用任何没有 Java 对应项的第三方 API? 如果是,请尝试坚持使用 C#
  • 您是否在“深层”(数据绑定、用户控件等)中使用 .Net? 如果是,请尝试坚持使用 C#
  • 迁移时间比聘请新的/转换的 C# 人员更容易接受? 如果不是,请尝试坚持使用 C#
  • 如果您要使用会改变演示文稿的 Java 框架,您是否认为最终用户不会接受更改? 如果是,请尝试坚持使用 C#
  • 检查广告

如果您决定转换:

  • 按组件进行
  • 按层
  • 进行大量测试
  • 检查是否有工具可以帮助(尽管帮助可能很小)迁移

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
咿呀咿呀哟 2024-07-23 07:52:10

只是为了补充 Brian 和 Eric 的观点,我想说的是,在我看来,为 Java 开发人员学习 C# 应该是简单的。 它们在概念上是非常相似的语言,我建议培训您的 Java 开发人员以获得一些 C# 技能,这样您就不会被迫经历迁移过程的麻烦。

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.

不必在意 2024-07-23 07:52:10

我同意 Joel 的观点,即完全重写几乎总是一个错误。 其他发帖者是正确的:C# 和 Java 非常相似,任何有能力的 Java 开发人员都应该能够在几周或几个月内胜任 C#。 这并不是说他们会成为专家。 这需要更长的时间,但只要您有一些 C# 开发人员可以指导该过程,那么您应该没问题。

在不了解应用程序的具体情况(大小、应用程序类型、行业等)的情况下,很难评论这种转变是好是坏。

我对这样的切换非常谨慎,因为以我的拙见,C# 现在是一种比 Java 更现代的语言,我作为一个已经从事 Java 开发十多年(自 1.0.2/1.1 以来)的人向您这么说。

这并不是说 Java 不好。 它不是。 Sun确实有一个阴云笼罩着它,并且近年来表现出不愿意或无能力推动该平台向前发展。

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.

别低头,皇冠会掉 2024-07-23 07:52:10

在完成将 .NET 项目转换为 Java 之前,所有参与转换项目的 Java 开发人员都将学习 C#。 那么您就不再需要将其转换为 Java(并且您可以丢弃转换中生成的所有 Java 代码),因为现在您拥有一个可以同时执行 Java 和 C# 的开发团队。 问题解决了。 :D

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

输什么也不输骨气 2024-07-23 07:52:10

不管涉及什么语言,这家公司的管理层听起来都很疯狂。 对于除了简单的应用程序之外的任何事情,从头开始重写整个代码库而不是仅仅雇用一个具有正确语言技能的人在经济上如何可能是明智的? 这家企业是否存在众所周知的问题:闲置资金过多?!

现有代码开发了多长时间? 如果是刚刚开始的话,我可以理解这一点。 如果它已经发布并拥有活跃用户,那么丢弃它永远没有意义。 如果您将 C# 代码捐赠给一家拥有适当技能的初创公司,请想一想他们会比您领先多少。

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.

ヤ经典坏疍 2024-07-23 07:52:10

查看 Net2Java,它旨在帮助您将代码从 C# 转换为 Java 。 我怀疑它会是完美的,但它是一种从任务中消除大量苦差事的方法,让您可以解决不兼容的框架调用和语言功能的问题。

完成此操作后,您的任务就像任何其他大型迁移项目一样 - 测试、测试、再测试。 单元测试,系统集成测试,然后最终用户测试。 您应该拥有与原始应用程序一起使用的那些测试,除了单元测试之外,它们仍然是相关的。

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.

孤独患者 2024-07-23 07:52:10

如果有任何组件已经隔离或者其中任何组件使用面向服务的架构,那么您可以想象一次迁移一个组件(其中每个单独的组件都是重写),并且仍然让组件使用相同的组件相互通信可互操作的网络协议。 可能取决于我们正在讨论的应用程序类型。

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.

初见终念 2024-07-23 07:52:10

确保您进行了大量测试,因为这样的迁移会在您最意想不到的地方发生。

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

夏了南城 2024-07-23 07:52:10

您是否有更多 .Net 或更多 Java 应用程序投入生产。 如果您已经在 .Net 服务器和应用程序上进行了大量投资,为什么不要求 Java 开发人员中的志愿者迁移到 .Net? 语言和语法非常相似,所以最难的部分是学习框架,除非他们将所有时间都花在 UI 开发上,否则学习框架并不难。

在我们的办公室里,我们有许多非常优秀的开发人员,他们根据需要在 Java 和 .Net 之间来回切换。

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.

音盲 2024-07-23 07:52:10

我不是 Java 专家,但根据我在作为 C# 粉丝时使用 Java 代码的经验,以下是一些可能令人头疼的问题:

  • Java 和 C# 中的泛型实现方式不同。
  • Java 和 C# 之间的装箱/拆箱行为不同
  • Java 类命名约定 + 大量 C# 生成的代码
  • 字符串处理(即 Unicode/ASCII 问题)可能会出现问题,具体取决于所移植的 Java/C# 代码的质量。

就我个人而言,我认为从头开始写作根本不是一个坏主意。 因为您已经有了一个工作架构。

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.

薄荷梦 2024-07-23 07:52:10

为了向管理层证明,您始终需要谈论投资回报率和数字。 向他们表明,如果您移动这些应用程序,将需要大量的时间和 QA 资源,并且如果由于某些其他项目或新开发的重要性而降低其优先级,则很容易退居二线。

当我向他们展示时间表、投资回报率、涉及的工作、涉及的资金等时,我取得了成功

。所以现在进入实际问题,我确实认为 Java 开发人员将能够支持 C#,除非他们对 Microsoft 技术有一些基本的心理障碍。

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.

淑女气质 2024-07-23 07:52:10

也许您可以使用 jni4net - 开源桥
或者我知道的其他选项列表。

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

寻梦旅人 2024-07-23 07:52:10

我有点惊讶没有人提出拒绝移民的想法。

我不相信 C# 开发人员会因为被告知而被迫切换到 Java(反之亦然)(好吧,如果他受到枪威胁,那么也许)。 我需要花费大量的时间、锻炼和热情来掌握至少一种技术堆栈。 您不可能一夜之间开始使用新技术并期望提供相同的质量。

我个人不会打扰,直到被告知开始迁移。 此时我会告诉经理,我是 .NET 人员,不会仅仅因为他们决定而转向其他技术。

至于技术方面,不同的不是语言语法,而是库及其功能。 当然,如果 .NET 3.5 的所有最新功能都已广泛使用,那么语言差异将为您带来真正的挑战。

这当然是一种有趣的方式,只是决定将应用程序从 .NET 迁移到 Java。 有人不知道其中涉及的麻烦......

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...

帝王念 2024-07-23 07:52:10

我意识到这是一个老问题,但对于走这条路的其他人来说,您可以尝试这个开源 C# 到 Java 转换器:

http://www.cs2j.com/

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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文