Hacker News new | ask | show | jobs
by dilithiumhe3 4381 days ago
Depends on what you want to do with your knowledge. To @nostradeamons' point, learning C++ basically means that moving over to Java is basically near zero effort but if your main aim in CS is to learn algorithms and concepts that are the science part of computer science, you may want to concentrate more on the implementation of the thing in point rather than worry about the nitty gritty details of manual memory management. Personally, I would learn Java and I have found mostly because it let's you get to the thing you want to do much more quickly than C++ would.

For example, if you are implementing a tree traversal algorithm, you are implementing the tree traversal mechanism and are rarely bothered with the "correct" way to traverse pointers or manage memory. It helps (in terms of productivity) to have built in language features take care of these things. For a "new" student, java seems like a good starting point and once you get a hold of the things you want to optimize, you can look in more depth or maybe even figure out you need to implement some parts in a different language altogether.

Flexibility of C++ vs Java is a contentious issue at best, concepts and best practices (from a CS view point) would apply across all languages.

* I started with C, then moved to C++, then Java, then Go so I know how it feels to progress through the language-sphere. The above views are my own and YMMV. I find C/C++ to be the best starting place but I know a lot of students who found it too low level and nit-picky and java seems like a good way to start. Again, YMMV.