TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

If you had a choice, which would it be: C++ or Java?

4 点作者 big_data超过 15 年前
Hey Hackers, here is my quandary. I have to make a choice between C++ and Java as the next language I learn at school. If you were me, which would you select? Why?<p>My career interests are mainly in data analysis, with perhaps some financial applications later on. Which of these two languages would give me the most traction?

9 条评论

ecyrb超过 15 年前
I happen to work for a company in the financial sector.<p>Our developers use Java (mostly).<p>Our research department uses whatever they are most comfortable with for research, but the result of their research is coded up in C++. If we had to do it over, we'd probably do everything in Java. Misc. notes:<p>Personally, I am WAY more productive in Java.<p>I supplement Java with Clojure.<p>I find the performance penalty for using Java is pretty-much negligible. It's always <i>how</i> you do it that matters more than <i>what language</i> you do it in. Don't use Java Generics for number crunching though... use a dedicated primitives collection library like Colt.<p>Java and C++ are quite similar in <i>some</i> respects. I would say though, that it's easier to go from C++ to Java, than from Java to C++.<p>Best C++ books:<p><i>Accelerated C++</i> by Andrew Koenig and Barbara E. Moo<p><i>Effective C++</i> by Scott Meyers (make sure you get the 3rd edition)<p>Best Java books:<p><i>Effective Java</i> by Joshua Bloch<p><i>Java Concurrency in Practice</i> by Brian Goetz, Tim Peierls, Joshua Bloch, and Joseph Bowbeer<p>If you have to use C++, start using the Boost C++ libraries early on. You can learn a great deal just by <i>using</i> the Boost libraries, and reading their documentation.
评论 #1105788 未加载
lambdom超过 15 年前
I think Java will help you focus on more high level stuff than C++, which is a good thing. For instance, you will spend less time debugging subtile C++ corner cases.<p>Also, a lot of C++ "good practice" are "built in" in Java. For instance, you won't have to use #ifndef #endif or to declare your function in a header file. So, again, I think Java is a better choice since, if you have to learn and use C++, you will already know the good practices.
notaddicted超过 15 年前
My POV (I don't have any special insight):<p>Big users of C++ are more tech-oriented. These are the people that would use something better but they need the 2x speedup, because it's a major competitive advantage in a mature pure tech firm.<p>example: google.com<p>Big users of Java are more enterprise-oriented. They use it because it is proven, and they can hire programmers for it, and they can manage big projects with it.<p>example: SAP.com<p>IMO: chase the $$$, learn Java. But if you work hard you can learn the basics fast, and keep learning other languages. Once you know many languages and the paradigms behind them, any given language is just a point in "language space" and the details of the language are obvious, because they couldn't be any other way.
评论 #1105809 未加载
评论 #1105815 未加载
pjharrin超过 15 年前
If you want to do quant finance as a career. Learn C++. It is the industry standard for quant work.
rbanffy超过 15 年前
Between C++ and Java? I would open a restaurant!<p>Seriously: of those 2 choices, I would tend towards C (more than C++). I would prefer more choice, of course. Current Lisp compilers are very efficient.
skennedy超过 15 年前
In addition to the point about chasing the $$$ by learning Java, I would definitely call your attention to C#. C# is based on C++, starting to pick up speed (think Sharepoint), and developers are coveted right now for the small but growing market.
评论 #1105757 未加载
makecheck超过 15 年前
C++ is really an expert's language. It should be something you learn after several other languages.<p>If you don't know Python, learn it. Then learn plain C, then perhaps Java, and only C++ after at least those 3.
评论 #1105898 未加载
big_data超过 15 年前
I am seriously bummed by my lack of choices. As always though, I want to make the best of it.<p>If I said that ultimately I wanted to use either language for distributed computing applications, which then?
评论 #1105746 未加载
freebsd_dude超过 15 年前
Since you trying to learn something as apposed to just get something done, go for C/C++.<p>C++ is closer to the machine. You'll have to worry about things like memory management, pointers, sigfaults, etc - a great learning experience.<p>After this you should be able to pick up Java no problem. Although if you want to be really productive or hate typing, Id pick Python.