从 .NET 迁移到 Java
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3521013/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Moving from .NET to Java
提问by Jamie
Possible Duplicate:
Tips for moving from C# to Java?
可能的重复:
从 C# 迁移到 Java 的技巧?
As a fairly experienced .NET developer (since 1.0), I've seen quite a few interesting jobs in the local area which are primarily focused on Java EE, ESB, WebSphere, JSP etc. Now, I'm quite familiar with most .NET "techs", but Java is a mystery. I did a bit of J2SE programming at University (2003 ish), but nothing much since.
作为一名相当有经验的 .NET 开发人员(从 1.0 开始),我在本地看到了很多有趣的工作,主要集中在 Java EE、ESB、WebSphere、JSP 等方面。现在,我对大多数 . NET“技术”,但 Java 是个谜。我在大学(2003 年左右)做了一些 J2SE 编程,但从那以后就没什么了。
Has anyone made the same transition (or the opposite one) and could share some info, caveats, anything really! How comparable are the .NET and Java skillsets, and how easily can one make the transition?
有没有人做过同样的转变(或相反的转变)并且可以分享一些信息、警告,任何真的!.NET 和 Java 技能组合的可比性如何?如何轻松地进行转换?
采纳答案by duffymo
I've faced the same problem going the other way: Java EE to .NET.
我也遇到过同样的问题:从 Java EE 到 .NET。
I don't have too much trouble with mapping language constructs between the two languages. It's not difficult to figure out relational database access in one language or the other. Loops are loops, ifs are ifs, kids. No worries there.
我在两种语言之间的映射语言结构方面没有太多麻烦。找出一种或另一种语言的关系数据库访问并不困难。循环是循环,如果是如果,孩子们。那里不用担心。
I've read Jon Skeets "C# In Depth", so I've gotten an appreciation for some of the nice things that have been added to C# that go beyond Java: LINQ, closures, delegates, etc.
我读过 Jon Skeets 的“C# In Depth”,因此我对 C# 中添加的一些超越 Java 的好东西表示赞赏:LINQ、闭包、委托等。
My problems had more to do with the other details.
我的问题更多地与其他细节有关。
Visual Studio is a mystery to me. I'm used to IntelliJ. ReSharper helps. But like any other IDE, until you become familiar with it you're going to be stumbling around, trying to map something that you know how to do well on another system to the new one. Visual Studio Express doesn't appear to be the same thing.
Visual Studio 对我来说是个谜。我习惯了 IntelliJ。ReSharper 提供帮助。但与任何其他 IDE 一样,在您熟悉它之前,您将四处走动,试图将您知道如何在另一个系统上做得很好的东西映射到新的系统。Visual Studio Express 似乎不是一回事。
I'm also ignorant of organizing, packaging, and deploying applications. I'm in the dark on .NET modules, deployment to IIS instead of a Java EE app server like WebLogic, etc.
我也对组织、打包和部署应用程序一无所知。我对 .NET 模块、部署到 IIS 而不是 Java EE 应用服务器(如 WebLogic 等)一无所知。
Using JUnit and TestNG in my Java projects is second nature. I don't have the same level of comfort with NUnit.
在我的 Java 项目中使用 JUnit 和 TestNG 是第二天性。我对 NUnit 没有同样的舒适度。
I simply don't have it on the tips of my fingers. It's like a person in a foreign country with a guide book to the language: "How do I say that?" I'm simply not fluent in .NET.
我只是没有它在我的指尖上。就像一个人在国外,拿着一本语言指南:“我怎么说?” 我只是不精通 .NET。
I could really use a good project and a month long pairing with an experienced guide to get me over the hump. But that's not my role on projects, so I'm stuck.
我真的可以使用一个好的项目和长达一个月的时间与一位经验丰富的指南配对来帮助我渡过难关。但这不是我在项目中的角色,所以我被困住了。
I'm more comfortable taking that same path with Python. I have PyCharm from JetBrains, so the IDE is a non-issue. Python modules are as plentiful and easy to use as 3rd party open source stuff that I'm used to. I've got a great book "Core Python" that's walking me through. And the more I use the language, the more I like it. I have the same packaging and deployment issues, but I'm more confident that I'll solve them on my own with Python than with .NET.
我更愿意用 Python 走同样的道路。我有来自 JetBrains 的 PyCharm,所以 IDE 不是问题。Python 模块与我习惯的 3rd 方开源内容一样丰富且易于使用。我有一本很棒的书“Core Python”,它正在引导我。我越是使用这门语言,我就越喜欢它。我有相同的打包和部署问题,但我更有信心使用 Python 自己解决这些问题,而不是使用 .NET。
回答by Johannes Wachter
In my opinion the difference between Java and .NET (C#) is not that big, from a language perspective. I myself frequently use both although I'm using more Java than C#.
在我看来,从语言的角度来看,Java 和 .NET (C#) 之间的区别并不大。尽管我使用的 Java 比 C# 多,但我自己经常使用这两种方法。
The problem is more the platform below and the class libraries that have a different structure and provide sometimes different concepts for the same thing. The main thing in my feeling is here that .NET is more driven by bundled/vendor libraries directly from Microsoft whereas on the Java Plattform most libraries and frameworks are coming from the platform-external sources.
问题更多的是下面的平台和具有不同结构的类库,有时为同一事物提供不同的概念。我的主要感觉是 .NET 更多地由直接来自 Microsoft 的捆绑/供应商库驱动,而在 Java Plattform 上,大多数库和框架来自平台外部源。
So the best thing in that regard is looking at frequent problems you solved in .NET and try to solve them (partly) in Java to get a feel for the libraries and frameworks used there.
因此,在这方面最好的事情是查看您在 .NET 中解决的常见问题,并尝试(部分地)在 Java 中解决它们,以了解那里使用的库和框架。
Another thing that is different between the platforms might be the concept of an Application Server in a Java EE environment, since I think .NET has no equivalent concept to host applications.
平台之间不同的另一件事可能是 Java EE 环境中应用服务器的概念,因为我认为 .NET 没有与宿主应用程序等效的概念。
Sidenote regarding the IDE
关于 IDE 的旁注
Especially in respect of Refactoring support the Java Tooling you'll find in Eclipse, IntelliJ, NetBeans is much richer than in Visual Studio out of the box. Though ReSharper seems to add much of the missing functionality to Visual Studio.
尤其是在重构支持方面,您会在 Eclipse、IntelliJ、NetBeans 中找到的 Java 工具比开箱即用的 Visual Studio 丰富得多。尽管 ReSharper 似乎为 Visual Studio 添加了许多缺失的功能。
回答by Josselin Pujo
As long as you stay away from complex classloader interactions, the language and standard library should feel home, what can be intimidating for somebody that comes from Microsoft shops is the overwhelming amount of libraries and middleware options, while the language is simple, the ecosystem is deep, very deep, and there is no real standard choice.
只要您远离复杂的类加载器交互,语言和标准库就应该有家的感觉,对于来自 Microsoft 商店的人来说,令人生畏的是大量的库和中间件选项,虽然语言很简单,但生态系统是深,非常深,并没有真正的标准选择。
I would concentrate on the 'standard' techs in the J2EE tutorialfor most enterprise shops, but if you ever get technical lead on a project, be ready to spend a lot of time researching the optimal set of tools for your style.
对于大多数企业商店,我将专注于J2EE 教程中的“标准”技术,但是如果您获得了项目的技术领导,请准备好花大量时间研究适合您风格的最佳工具集。
回答by bporter
I've recently made that transition. Like you, I've programmed using .NET since 1.0. It took me a few weeks to really get comfortable - but ultimately, coming from C#, it wasn't very difficult. The most confusing thing starting out was shifting from the .NET delegate-based event handling paradigm to Java's interface-based event handling paradigm. You'll be fine.
我最近进行了这种转变。和您一样,我从 1.0 开始就使用 .NET 进行编程。我花了几周的时间才真正适应 - 但最终,从 C# 开始,这并不是很困难。开始时最令人困惑的事情是从基于 .NET 委托的事件处理范式转变为 Java 的基于接口的事件处理范式。你会没事的。
Regarding IDE - I still prefer Visual Studio to Eclipse, but everyone will have their own opinion about that. Eclipse has a ton of features and is rediculously expandable, but I'm more concerned with the basic functionality I use every day. I never realized how much code I wrote using the TAB key until I switched from Visual Studio to Eclipse. I really miss the quick auto-complete. If there's a way to turn a similar feature on in Eclipse (instead of typing CTRL-SPACE -> ENTER) please let me know. :)
关于 IDE - 与 Eclipse 相比,我仍然更喜欢 Visual Studio,但每个人都会对此有自己的看法。Eclipse 具有大量特性并且可扩展性非常可观,但我更关心的是我每天使用的基本功能。在从 Visual Studio 切换到 Eclipse 之前,我从未意识到我使用 TAB 键编写了多少代码。我真的很想念快速自动完成。如果有办法在 Eclipse 中打开类似的功能(而不是键入 CTRL-SPACE -> ENTER),请告诉我。:)
Good luck! :)
祝你好运!:)
回答by Ehsan
I would suggest you to start with a small project using an architecture similar to .NET one like JSP which is like ASP or JSF -which is similar to Java Server Faces. Then you don't need to bother that much about the concept you will get more into language diferences and IDE, deployment and these stuff. Then you can go for a proper J2EE application.
我建议您从一个使用类似于 .NET 的体系结构的小项目开始,例如 JSP,它类似于 ASP 或 JSF——类似于 Java Server Faces。然后你就不需要过多关注这个概念,你将更多地了解语言差异和 IDE、部署和这些东西。然后,您可以选择合适的 J2EE 应用程序。

