Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Java or C++ for CS (no programming background)
1 point by PopcornTimer on June 16, 2014 | hide | past | favorite | 2 comments
New Computer Science student. Intro to programming course is offered in both languages (basically the same course). Which one should I pick. It's required and they give you the option to pick the Java version or the C++ version.

No prior programming experience. Please advise.



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.


C++. It's relatively easy to pick up Java if you know C++. Picking up C++ if you know Java requires unlearning some habits and learning a bunch of new concepts, though. If you want to optimize for flexibility after college, C++ will set you up better.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: