C++ vs Java - Learning purposes

Pages: 12
Ok I want everyone's opinion and reasons. What do you think should be the language to be taught in CS programs, C++ or Java? And try not to be TOO biased here :D
closed account (1yR4jE8b)
Python
For introductory classes I'd suggest Python, maybe Java.

Past that point the language they use should really only be limited by what topic the course is covering.

if it's some general comp sci theory course then what ever language you're comfortable with. If it's an AI course something like prolog, lisp or smalltalk. A class covering things on the hardware level should use C/ASM, ad infinitum
Both, of course. I think a good sequence of languages to learn would be Haskell - Java - C++ - Asm, consistently moving from abstractions to machinery, starting from either end.

1111 1111 1111 th post
Last edited on
for low level programming: assembly and C
for high level programming: Scala, because it covers most of Java + Haskell + Python + Ruby + ML + C++, yet being a reasonably simple language
Last edited on
C# is my favourite high-level language; Haskell is excellent too.
Learn Haskell then.
Sorry I posted my last reply in the wrong thread! Haskell was being talked about in the other as well, but yea I plan on picking up Haskell soon, just for the learning purposes.

Now back to the topic at hand, I hear a lot of debate that schools should NOT teach Java, and that they should teach C++ instead. I agree with that, I think Java is just a simplified version of C++ that likes to hold your hand through everything. I do have to say Java would probably be easier from the universities point of view though. It comes with a much larger standard library than C++ does, so you don't necessarily have to worry about 3rd part libraries if you don't want. And if you know C++, you can easily pick up Java in a weekend. If you know only Java, it's going to be a little harder to pick up C++
I feel java or even c# are better suited to teaching general programing concepts without the added confusion of pointers and strict memory management. And going from java to c++ was not hard for me because I was familiar with the base concepts.
Without learning C or C++, you're too far removed from the computer to really care or understand how the machine works.

I don't think they're ideal for learning programming, but they should be understood in some depth if you're serious about programming.
I think an assembly language is a better choice if you really want to understand how the computer works.

My recommendation is to learn the assembly language of one of the RISC (Reduced Instruction Set Computing)[1] processors like MIPS, PowerPC (XBox 360, pre-iMac Macs), SPARC and ARM (Android, iPhone). They're usually much simpler; the idea is that with a load-and-store architecture[2] and a simple instruction set, even at lower clock speeds you can get better performance by using less clock cycles per instruction. Modern Intel-/AMD-based CPUs tend to be faster because of the amount of money both companies have burned on R&D (especially Intel, since recently, AMD mostly just copies them, or trolls them by haplessly adding more cores[3] (don't get me wrong, I'm not an Intel fanboy--I use an AMD CPU--but it's true)).

Alternatively, some other simple assembly languages are those of the MOS 6502 and Zilog Z80 (which is very similar to the original 8086).

After you've done that, then you should learn x86 and then x86-64 (assuming those are your favoured platforms).

1. http://en.wikipedia.org/wiki/Reduced_instruction_set_computing
2. http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Mips/load.html
3. http://i.imgur.com/RnhOV.jpg (I could only find the thumbnail).
Last edited on

And if you know C++, you can easily pick up Java in a weekend


If you meant learning only the subset of Java that is in C++, then I agree. But it would be probably still a minor fraction of Java. I gave Java courses to C++ developers, and after a 5 day course, they could write simple Java programs, but they were nowhere near the "productive" level. Java's standard library is more than 10x bigger than that of C++ (even including C++11) and you have to know at least part of it to avoid such stupid errors like using Vectors instead of ArrayLists or appending to a String instead of StringBuilder. You can't learn it by reading JavaDoc. You have to code and it takes some time.


even at lower clock speeds you can get better performance by using less clock cycles per instruction


This is particularly true also for modern Intels and AMDs. Internally they are RISCs, too. But I agree, picking up MIPS is a good way of learning how hardware works.

BTW: The long-term trend is that number of Java jobs is increasing, while the number of C++ jobs is declining, so it is a better bet to learn Java:

http://www.indeed.com/jobtrends?q=java%2C+c%23%2C+c%2B%2B&l=
Last edited on
Hell, why not learn both? Any skill you gain can be turned into use even if you will never use it directly. That is to say, take what you've learned and apply it (conservatively and with reason... what is great in one language may be horrid in another) to production in other languages.
closed account (1vRz3TCk)
ResidentBiscuit wrote:
What do you think should be the language to be taught in CS programs, C++ or Java?
I never really know how to answer this kind of question. When I went to University; in the first year we used something like seven different languages to learn various aspects of computer science. Even the modules that where purely about 'programming' did not teach a specific language.
Yeah, that Stanford YouTube lecture videos say they use like Scheme and several other languages throughout just one course. In their Programming Paradigms course they learn C, Assembly, C++, Concurrent Programming, Scheme, and Python alone.
closed account (yh54izwU)
Huh you take more than just one. I am attending SMU and you are taught Java, C++ (including data structures), PHP, Arm, sql (if you want to count it although it technically isn't one), and you are encouraged to learn C#, objective C, and Python

If you mean for beginners I would suggest C# it gives students the chance to learn some of the C++ functionality with the ease and versatility that would translate in Java

C# for life(suck it Java)
Last edited on
Windows only, single-company support languages should not be taught at public universities.
Windows only? C# has mono under Linux (used it once under Debian I think it was). Can't touch the single-company thing as that is true. Though DeVry supported a single company (when I was doing the GSP degree they focused everything around the Torque Game Engine and the Garage Games line of product). Last I knew they now use UDK and only touch on programming for two courses where you are actually challenged then everything else was given to you and told to just copy and paste it and where to paste it.
closed account (yh54izwU)
Why? C# is consistently one of the top 2 languages companies are looking for. It doesn't matter who supports it, if companies want you to know it schools should offer it.
To be fair, Mono isn't the best-developed library in the world. So I've heard. :@

-Albatross
Last edited on
Pages: 12