TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

4 pointsby big_dataover 15 years ago
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 comments

ecyrbover 15 years ago
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 未加载
lambdomover 15 years ago
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.
notaddictedover 15 years ago
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 未加载
pjharrinover 15 years ago
If you want to do quant finance as a career. Learn C++. It is the industry standard for quant work.
rbanffyover 15 years ago
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.
skennedyover 15 years ago
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 未加载
makecheckover 15 years ago
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_dataover 15 years ago
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_dudeover 15 years ago
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.