如何移植开源项目?

发布于 2024-08-20 18:08:10 字数 1436 浏览 8 评论 0原文

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

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

发布评论

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

评论(2

血之狂魔 2024-08-27 18:08:10

不幸的是,如此大的项目通常需要付出更大的努力。在一种语言中有效的东西在另一种语言中可能并不有效,更重要的是,在一种语言中存在的东西在另一种语言中可能不存在。例如,NHibernate 花了几年来移植,而且他们仍在这样做(尽管一直在添加功能,如 Linq)。

这通常是坐下来并逐个移植类、尽可能优化、在需要时更改结构的问题。诸如泛型、别名和装箱之类的东西都在端口中发生了变化。然后,在你完成这一切之后,通常还有很多优化需要完成(当然这是可选的......),也许是事件,也许是静态和扩展方法,可能是你的新语言/平台提供的任何东西旧的没有。

这样想,为什么要把它移植到.Net?我敢打赌,您正处于两种情况之一,一种是您因为工作而不得不使用 .Net(哦,抱歉!),另一种是您喜欢 .Net,因为它为您提供了一些优势。在第二个类别中,这意味着您选择了它而不是 Java,因此在移植时您会希望利用最初让您选择 .Net 的任何功能。

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.

栖迟 2024-08-27 18:08:10

就像尼克说的那样,事情没那么简单。涉及的不仅仅是移植代码,特别是如果您要移植的应用程序的体系结构不是很好的话。您想要使用要移植到的语言的功能,有时您可能会更改它们的设计决策,因为它们对您来说似乎不合适。我不打算重申尼克所说的话,但想补充以下内容。

我建议关注 Noda Time 的开发,这是 Jon Skeet 尝试将 Joda Time 从 Java 移植到 .Net。 Jon 实际上在以下博客上记录了这一经历:

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

我建议关注博客、该项目的谷歌群组页面和谷歌代码项目。谷歌组和代码页链接可以在博客上的一篇文章中找到。

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.

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