为有经验的 C++ 开发人员快速切换到 Java
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1749217/
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
Rapid switch to Java for an experienced C++ developer
提问by MadH
I'm am looking for online tutorials/books, which assume a solid knowledge of OOP/Design patterns concepts and stress on differences (both conceptional and syntactical) between C++ and Java thus allowing for a rapid development in the latter. Thank you very much in advance, appreciate your time.
我正在寻找在线教程/书籍,它们假定对 OOP/设计模式概念有扎实的了解,并强调 C++ 和 Java 之间的差异(概念和语法),从而允许后者的快速开发。非常感谢您,感谢您的时间。
回答by Gerd Klima
It is kept up to date and well written. Also available in hard-copy.
它保持最新并且写得很好。也有硬拷贝。
I'm always skeptical about "change from X to Y" guides. Though they may help as reference points afterwards, learning a new language by coming from another one may be tricker than you think.
我总是对“从 X 到 Y 的变化”指南持怀疑态度。尽管它们可能会在以后作为参考点有所帮助,但从另一种语言学习一门新语言可能比您想象的要棘手。
I think it is important to learn the new language "as designed" and to get the feel for the way to things "right" in this language and also learning its code idioms.
我认为重要的是学习“按设计”的新语言,并了解这种语言中“正确”的方式以及学习它的代码习语。
As a good book for experienced programmers who also want to learn about potential pitfalls of Java, I recommend Effective Java.
对于想要了解 Java 潜在陷阱的有经验的程序员来说,作为一本好书,我推荐Effective Java。
回答by unwind
When I did (sort of) this, I used O'Reilly's Java in a Nutshell. It now seems to be more like "Java in an intermodal shipping container" though, so perhaps it's not as quick anymore. I would still expect it to be decent, I think it's more reference material nowadays.
当我(有点)这样做时,我在 Nutshell 中使用了 O'Reilly 的Java。不过,它现在似乎更像是“多式联运集装箱中的 Java ”,所以也许它不再那么快了。我仍然希望它是体面的,我认为它现在更像是参考资料。
回答by Thomas Owens
If you are an experienced C++ developer, I would recommend skimming through the Java Tutorial(as mentioned by Gerd Klima). Then, just open up the Java API documentationand jump right in, feet first.
如果您是一位经验丰富的 C++ 开发人员,我建议您浏览一下 Java 教程(如 Gerd Klima 所述)。然后,只需打开Java API 文档并立即开始,双脚先行。
回答by Adrian Grigore
There are several books covering "Java for C++ Programmers" on Amazon.
Amazon 上有几本涵盖“ Java for C++ Programmers”的书籍。
回答by JRL
You definitely need a book, and there are many out there.
你肯定需要一本书,那里有很多。
Beyond that, one thing that helps, IMHO, is a cheatsheet, that you can print and put up next to your monitor. As you learn stuff you can add them to the sheet.
除此之外,恕我直言,还有一件事有帮助,就是一张备忘单,你可以打印出来贴在显示器旁边。当您学习东西时,您可以将它们添加到工作表中。
Here are a couple, specifically for C++ programmers:
这里有几个,专门针对 C++ 程序员:
回答by mip
O'Reilly's 'Head First' books are very well written. Take a look at Head First Javaand Head First Design Patterns.
O'Reilly 的“Head First”书籍写得非常好。看看Head First Java和 Head First Design Patterns。
回答by iain
I moved from C++ to Java 6 years ago an used "Effective Java" by Bloch, this is a style book which explains in 50 short articles how best to use various java classes and techniques. This is very similar to "Effective C++" by Meyers and "Exceptional C++" by Sutter.
6 年前,我从 C++ 转向 Java,这是一本由 Bloch 撰写的使用过的“Effective Java”,这是一本风格书,用 50 篇短文解释了如何最好地使用各种 Java 类和技术。这与 Meyers 的“Effective C++”和 Sutter 的“Exceptional C++”非常相似。
If you already know C++ and object oriented programming and can read Java this is the fastest way to write good quality java code.
如果您已经了解 C++ 和面向对象编程并且可以阅读 Java,那么这是编写高质量 Java 代码的最快方法。
There is a new edition out now with generics etc. In my mind this book is essential for all Java programmers as well as those wanting to learn Java.
现在有一个包含泛型等的新版本。在我看来,这本书对于所有 Java 程序员以及那些想要学习 Java 的人来说都是必不可少的。
回答by plinth
I made this transition in 1996 or so when Java was newish. A book will definitely help. I used Laura Lemay's 21 day book, which is now up to rev 6. It took me 3 days to get through the original book and another week before I felt I was fully conversant.
我在 1996 年左右进行了这种转变,当时 Java 还是新生事物。一本书肯定会有所帮助。我使用了Laura Lemay 的 21 天书,现在已达到第 6 版。我花了 3 天时间读完原书,又花了一周时间才觉得自己完全熟悉。
Things to get used to:
需要习惯的事情:
- The language is not huge, but the support libraries are. There probably is already something that does what you want
- Garbage collection and sane memory management is awesome. My bug count plummeted in working with Java compared with C++
- Garbage collection and sane memory management sucks. I was writing performance critical applications and (at the time), I would've killed someone to get something similar to placement new or operator new overload.
- Garbage collection is not general resource collection (ie, open files etc). You still need to worry about that.
- I really missed having an integrated macro preprocessor. You can still use one, of course, but then your build has just gotten more complicated.
- 该语言不是很大,但支持库很大。可能已经有一些东西可以做你想要的
- 垃圾收集和合理的内存管理很棒。与 C++ 相比,我在使用 Java 时的错误数量急剧下降
- 垃圾收集和理智的内存管理很糟糕。我正在编写性能关键的应用程序,并且(当时)我会杀死某人以获得类似于placement new 或operator new 重载的东西。
- 垃圾收集不是一般的资源收集(即打开的文件等)。你仍然需要担心这一点。
- 我真的很想念有一个集成的宏预处理器。当然,您仍然可以使用一个,但是您的构建变得更加复杂。
回答by Pete Prokopowicz
Avoid head first Java. It is low signal to noise. Nutshell is good but has become huge, like the language.
避免首先使用Java。它是低信噪比。Nutshell 很好,但已经变得庞大,就像语言一样。