4 ms·
Ask HN: Which complied language to learn?
Hi,
I'm a programmer who is fairly well versed with interpreted / dynamic languages (Python, JS, ruby). I've started revisiting my algorithms course and felt the need to implement the algos in a complied language. I vaguely know Java to the point of not knowing it at all. So my question is - which of 2 languages ( Java/C++ ) should I learn.
Considerations in order of priority -
1. Ease of learning (minimum amount of time required to be productive for someone coming from py/rb/js)
2. Free online resources to learn
3. Powerful standard library so that I can use heaps, lists and dicts as easily as I do in Python
4. Performance
5. Should not require need an IDE to be productive (I love Vim)
6. Market Demand
Thanks a lot!
- facorreia 14y agoFor learning basic algorithms I would say C, but given your requirements, I think C++ fits the bill.
- shail 14y agoI would suggest C followed by C++ (for the STL and other library). I think every programmer should learn C/C++ at some point. Don't ask me for reasons for thinking so. Just a feeling.
- ishener 14y agoI almost said Java because it fits most requirements perfectly, but requirement no. 5 makes it much harder to recommend it over C++. I think that developing in Java without an IDE can be a pain... You love VIM, that's great. But do you hate IDEs? if the answer is no, I recommend trying it...
- krat0sprakhar 14y agoIs there something like LPHTW[1] for Java? I've owned a book called "Core Java by Horstmann" and the sheer size of the book is scary. Can you suggest some good resources that can I get up to speed with? Thanks [1] - http://learnpythonthehardway.org/ http://learnpythonthehardway.org/
- ishener 14y agoI don't know about online tutorials, but I do recommend the book Head First Java
- dagw 14y ago1: Probably Java. C++11 makes many things related to pointers and memory management easier, but there are still lots of corner cases that will bite you. 2: If you want to learn modern idiomatic C++11, then there aren't many online resources out yet, but it's getting better fast. 3: a tie 4: C++, but for many 'normal' use cases it's not too big a difference 5: C++ 6: Depends entirely what you want to do. Java is pretty ubiquitous in large companies and for writing enterprise system. C++ is more of a niche language these days, used in areas like 3d-engines, high-speed simulations, low-latency systems and other areas where performance is paramount. With all that said, personally I'd learn C as well. Calling C from most dynamic languages is pretty easy (certainly easier than calling C++ or Java) and the combination of the productivity of your dynamic language of choice plus the speed of C when needed is a very powerful one.
- vijaytsr 14y agoI would recommend C. It will give you a better understanding of the concepts of programming. Gives you more control over what you can do. But, as others have pointed, very easy to make mistakes
- mhd 14y agoI think you're split pretty evenly between Java and C++ given your requirements. Although it would tend more towards C++ if you could find a decent introduction that starts out with C++11, which I'm not aware of right now (standard is pretty new). If you're going with "old" C++ and then just add the new bits in the end, you're wasting a lot of time (as would be the case if you're going C -> C with Classes -> Generic Programming -> "Modern C++"). Not that it's that much better in Java, where most tutorials leave you wallowing through outdated or complicated features, especially if you're restricted to an older standard and no non-JDK libraries (like Guice, Apache Commons etc.). The Google C++ class is short and succinct, and could be a good start, although I would recommend reading up on C++11 features as soon as possible after finishing that. http://code.google.com/edu/languages/cpp/basics/ http://code.google.com/edu/languages/cpp/basics/ http://www.stroustrup.com/C++11FAQ.html http://www.stroustrup.com/C++11FAQ.html http://en.cppreference.com/w/ http://en.cppreference.com/w/ http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx http://msdn.microsoft.com/en-us/library/vstudio/hh567368.asp... For Java, the official Sun, erm, Oracle tutorials are decent enough, especially if it isn't your first language: http://docs.oracle.com/javase/tutorial/ http://docs.oracle.com/javase/tutorial/
- johncoogan 14y agoWhat about Go? http://golang.org/ http://golang.org/ This is a bit off topic but I'm in a similar situation and wanted to know if anyone had any thoughts on Go. It seems to strike a balance on everything except for current market demand (which could change going forward).
- jamesjguthrie 14y agoI'll put my vote in for Java mainly because along with Objective-C it's where I do most of my work so there's clearly (at least some) market demand for it.
- fidanov 14y agonot a fan of each those, but Java. I think it is easier to learn and especially as you come from python you will know how to avoid common misunderstandings. If you learn java, please, please, please don't learn from "thinking in java". This is one of the books with huge influence which is totally wrong in 99% of the times.