Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm starting some CS classes at a community college and they have two tracks. Either you take three courses in C++ or three courses in Java. Both cover the same fundamental material e.g. data structures, algorithms etc.

Which would you recommend considering that I know python and may be consider doing a masters in CS some time down the road....my undergrad degree is in something else. And advice would be appreciated.

share|improve this question

closed as off-topic by MichaelT, GlenH7, Bart van Ingen Schenau, Dan Pichelman, gnat Jun 18 at 19:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking career or education advice are off topic on Programmers. They are only meaningful to the asker and do not generate lasting value for the broader programming community. Furthermore, in most cases, any answer is going to be a subjective opinion that may not take into account all the nuances of a (your) particular circumstance." – MichaelT, GlenH7, Bart van Ingen Schenau, Dan Pichelman, gnat
If this question can be reworded to fit the rules in the help center, please edit the question.

    
I don't think there's really a "wrong" choice, provided the college is offering the same basic quality in both, but perhaps you could add more detail about what kinds of tasks or fields you think you'd want to do for your masters or in the workforce. –  Darien Jul 1 '11 at 6:33
1  
No question is complete without someone linking to a Joel article –  badgerr Jul 1 '11 at 7:50

7 Answers 7

up vote 16 down vote accepted

I would say C++ if only for the fact it takes a bit more thinking on your part. Java was designed to be easy to use. In C++ it's a lot harder to get something to work if you don't know whats happening.

Namely in C++ you have to worry about Object (de)allocation and Pointers. Which are solved problems in Java.

Besides java is pretty easy to learn once you know C++ but not so much the other way.

share|improve this answer
1  
Moving between either one involves some pitfalls in terms of how you think about objects or primitives and their lifetimes, though. –  Darien Jul 1 '11 at 6:32
1  
I would give the opposite reason - Java as it is less complex so you can concentrate on the important part the data structures, algorithms etc –  Mark Jul 1 '11 at 11:09
    
@Mark: Java is more complex... the JVM is between the code and the machine, and it is not a simple thing. –  kevin cline Jul 2 '11 at 6:51
    
but when learning algorithms and data structures you don't need to know the machine –  Mark Jul 2 '11 at 10:00

I would say it depends on what you want to do your Masters later on. C++ is very low level when it comes to pointers and memory and basically any I/O. Java makes those I/O type operations much easier.

So if you want to do your Masters in device drivers or operating systems or compilers, then C++ is a good foundation. If you want to do your Masters in something more like information systems i.e. web type applications, e-learning applications or any application where the focus is more on the HCI than the low level functionality, then Java is better.

I will be starting my Masters in 2012 where the thesis will be on the HCI using a real time trading system, so that will be Java / JavaScript since the interface will be a web app.

share|improve this answer
    
Are there really masters programs in device drivers? Just curious. –  Daniel Jul 1 '11 at 6:48
1  
-1, C++ is used for a lot more than device drivers/OS/compilers. Actually those are often coded in C rather than C++. –  MAK Jul 1 '11 at 12:02

Start with either one. If you have no prior programming experience, Java is probably your better bet.

As you progress through your education, be sure to learn the other one, whichever that is. Knowing both will serve you well in the long run.

share|improve this answer

My first reaction is, "That sounds like an odd thing for the college to do."

My second reaction is, "Java!"

The line is getting a little more blurred these days. But I would say that if you are interested in web development pursue Java, and if you are interested in systems pursue C++. Use that guide loosely, though.

share|improve this answer

I've always thought it easier to go from C++ to Java than the other way around. With C++ you will be able to write a Java VM, not so with Java! I think you keep your options open more with C++ than you do with Java and you will learn a lot of fundamentals to do with memory management and pointers, and proper templating and deterministic destruction of objects etc etc - stuff that is still important in today's world, despite what people may say!

share|improve this answer
1  
Not true: You are able to write a Java VM in Java... it'd be slow though. –  Spoike Jul 1 '11 at 6:43
    
@Spoike - Wouldn't your JVM in Java also have to run in its own JVM? Unless you first implemented a Java to Machine Code compiler. –  Zhehao Mao Jul 1 '11 at 14:22
    
@Zhehao Mao - Not necessarily. You chould run another JVM to run the java-made JVM. :-) –  Spoike Jul 1 '11 at 14:29
    
That's what I said. –  Zhehao Mao Jul 1 '11 at 15:03
    
Please, FTLOG no one try that! –  fwgx Jul 4 '11 at 7:34

On the low-level side:

  • Since you know python, C++ will probably teach you more about programming and expand your worldview.
  • Java will probably constrict your thinking, since it's all about objects, nothing else. (not even overloading the operators...). However, you will learn how it is to work with a language (and IDE) where things like auto-completion and type checking work really well and where errors are understandable.

On the high-level side:

  • It's easier to do networking/web/services/db/GUI/whatnot in Java, since the language is easier to work with. If you want to go enterprise-y (or C#-ish)in the future, this is the way.
  • C++ has more traction with game development, heavy visualization and computation, so if you want to go down that route, there are more libraries and tools available for you.
share|improve this answer

From what I understand, you can never learn enough languages because they'll always be useful. Sure, you might use ever single one every day. But if all you're doing is wondering which of the 3 to focus on I'd say focus on the one that's harder for you. I've studied C++, Python, and Java as well. C++ was harder for me because of all the flexibility and complexity so I took that class and studied Java and Python on my own. All three of those languages are commonly used by big companies so it wouldn't be considered a "waste"

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.