Which one [language] next?

  • #1
I have just finished an intro course on Python. As most others, I have the goals of learning Java, C and C++. In what sequence should I learn them? I am inclined on learning Java first as it is a prereq for some courses that I am eager to take. Yet, is it what you would recommend?
Note: I loved Python(if that would help in choosing which I should take first)
 

Answers and Replies

  • #2
phinds
Science Advisor
Insights Author
Gold Member
16,838
7,711
I suggest C first, as it is the only non-OO language on your list and is the syntactical basis for C++, Java, JavaScript, and other languages.
 
  • #3
jim mcnamara
Mentor
4,299
2,913
I would second that suggestion. You also need to remember that in a career you will probably bounce around using different technologies and language frameworks. I started with COBOL and FORTRAN long ago. Now I use C and specialty languages like dtrace.
 
  • #5
29
3
I third that suggestion. Learn C, then learn Java. Good luck.
 
  • #6
AlephZero
Science Advisor
Homework Helper
6,994
293
I suggest C first

I'm inclined to disagree with that. If you learn enough C to write useful programs, you will have to "unlearn" most of what you learned about pointers to write good C++, and all it to write any kind of Java.

Just because C came first historically, that doesn't mean it's the place to start learning. Otherwise, why not start teaching 5 year olds Sanskrit and Latin in school, and leave Engiish till later on?
 
  • #7
phinds
Science Advisor
Insights Author
Gold Member
16,838
7,711
I'm inclined to disagree with that. If you learn enough C to write useful programs, you will have to "unlearn" most of what you learned about pointers to write good C++, and all it to write any kind of Java.

Just because C came first historically, that doesn't mean it's the place to start learning. Otherwise, why not start teaching 5 year olds Sanskrit and Latin in school, and leave Engiish till later on?

I agree w/ you about pointers but that's about the ONLY thing in C that's like that. My point is that it is best to learn the fundamental syntax of a language before you start piling on OO concepts which are a bit complex for beginners. AND, C is the basis for many modern languages.

Why do you figure so many people agreed w/ my suggestion?
 
  • #8
29
3
I agree with Phinds. I learned C and knowing pointers did not slow me down in any way for learning Object Oriented Programming.
 
  • #9
D H
Staff Emeritus
Science Advisor
Insights Author
15,393
686
A different tack: Don't learn to program in another language. Learn to program, period. If you are going to college, almost every college will offer a course (or courses) in algorithms and data structures, and another course (or courses) in numerical methods, and yet another in structured programming. Those classes are worth a whole lot more than learning to program (badly) in yet another language.

People at this site oftentimes have the mistaken notion that you can learn to program on your own. Yes, you can learn to program badly on your own. It's easy. I see these (non) programmers all the time. You can also learn to program badly by using cargo cult techniques where you follow examples by others who learned to program on their own.

Can you learn how to program well on your own? Yes, but it's just about as likely as learning general relativity on your own.
 
  • #10
Cod
324
4
Is there a reason you want to learn another language? Why not go into some more advanced Python before moving on? Python is very robust and offers a lot to the science community via SciPy.

Also, like D H stated above, learn to program and worry about language specifics second.
 
  • #11
6,054
391
If you learn enough C to write useful programs, you will have to "unlearn" most of what you learned about pointers to write good C++

Writing good C++ does not mean ignoring pointers. You have to know what they are, and you have to do your memory management. It is true that many good libraries (and to some extent coding styles and conventions) lessen the burden, but to appreciate their utility and even to choose rationally which one is to be used, one still has to be cognizant of these matters. Creating good C++ libraries, on the other hand, pretty much requires one to embrace all these intricacies.

More generally, one principal difference between C/C++ and Java (or C#) is that the former works on the "bare metal", giving direct unsafe and unchecked access to memory, and supporting unsafe and unchecked type conversions. Learning and using this trait of the language is essential for mastery of C++; otherwise, there is simply no reason to bother ever studying it, because everything else can be done comfortably with a "safe" language.

C and C++ are difficult as first languages, because one has to study "basic programming" and the language at the same time. A "Hello, World" program already uses pointers and it gets worse.
 
  • #12
harborsparrow
Gold Member
611
154
Whatever language you use, it pays to learn what is really going on in memory. Python, and to some extent Java, try to protect you from needing to know that. But ultimately, it pays to know, especially if you ever need to be concerned about performance. C++ will require you to learn how things are being stored--and more detail than you'll like, so it will take longer to become competent with it. But likewise, in Java (and other object oriented languages) the way the objects consume memory (and their lifetimes in your programs) is very important.

Good luck! All good languages.
 
  • #13
12,768
6,642
Or you could consider learning Scala which has been described as a better Java than Java. It has features of scripting languages and forces you to think more about how to do things in OO and in functional programming:

http://en.wikipedia.org/wiki/Scala_(programming_language)

The argument for C vs Java just reminds me of the decades old one of C vs Assembler... basically the new generation language versus the old generation language learned by the older generation.
 
  • #15
993
64
C is still used for systems software and hardware drivers. Even if that may not interest you, there is still lots of existing C code that one may need to interact with, particularly libraries. Sometimes you can get away without actually writing C code (by using ctypes, cython, or other helpers), but you still need to understand C code.
 
  • #16
Why learn C if C++ exists? Not to be obnoxious or malicious...
 
  • #17
D H
Staff Emeritus
Science Advisor
Insights Author
15,393
686
Why learn C if C++ exists? Not to be obnoxious or malicious...
If you want an obnoxious answer, ask Linus Torvalds.

For a less obnoxious answer, C and C++ are very different languages that have some superficial similarities. It takes at least a year, and often two or more years, for a proficient C programmer to become proficient in C++. It's a hard transition. It takes even longer for a proficient C++ programmer to become a proficient C programmer. Going from C++ to C is even harder than going from C to C++.
 
  • #18
For most intents and purposes C can do anything C++ can do, considering that he's doing it for a hobby(I think). and C++ is easier than C as it shares more similarities with the other languages (I dunno about pythn have only done super simple calculating things in it.)
 
  • #19
6,054
391
C can do anything any other language do. So can C++. So can many other languages. This is mot a property that makes a lot of difference these days.
 
  • #20
But if c++ is easier and more widely used don't you think that's what he should learn?
 
  • #21
D H
Staff Emeritus
Science Advisor
Insights Author
15,393
686
The original poster has already learned one object oriented language, python. C++ is just another object oriented language. It's a good idea to learn a language from different paradigm rather than relearn one from the same paradigm. Switching paradigms forces a change in how one thinks. C is not object oriented. It's a procedural language. Another very different choice would be to learn a functional language. An example is Scala, mentioned in post #13. Others in this vein include the Lisp family of languages and Haskell.
 
  • #22
Okay I get your angle but then shouldn't he learn vbs or a scripting language? it'll give him the nessacary perpective and wont take long. If he actually wants to program something efficient he should use a OOL.

Order of my languages : batch->vbs->java->Delphi->c#->c++(learning) but I have seen code exerpts form c and other languages.

Never learn Delphi btw it's terrible. Programmers call it and I quote "a waste of brain space" I only learnt it because we had to at high school.
 
Last edited by a moderator:
  • #23
993
64
Why learn C if C++ exists? Not to be obnoxious or malicious...

C++ is not a replacement for C. It didn't make C obsolete.

C++ is not "easier" than C. It adds a huge amount of complex syntax. There is a lot of poor ad hoc design in the language. And after all that, you don't even get automatic memory management.

And it's certainly not more common than C.
 
Last edited:
  • #24
34,904
6,647
For most intents and purposes C can do anything C++ can do, considering that he's doing it for a hobby(I think). and C++ is easier than C as it shares more similarities with the other languages (I dunno about pythn have only done super simple calculating things in it.)
How do you implement classes and inheritance, for example, in C? Or polymorphism, or friend relationships between classes, or ...?

But if c++ is easier and more widely used don't you think that's what he should learn?
Given that C++ is a much larger language than C, in terms of keywords and concepts, I don't see how you can possibly say that C++ is easier than C. And it's debatable that C++ is more widely used than C.
 
  • #25
harborsparrow
Gold Member
611
154
C++ is a superset of C. What was added was object-oriented capabilities; however, the inclusion of multiple inheritance, combined with the high risk of memory leaks, makes C++ a troublesome object-oriented programming language at best. Thus, when implementing an object-oriented design, many programmers prefer to use more modern OO languages such as Java or C#.

Also, C++ is a very large language, with an extremely extensive set of libraries, and they can be quite complex. Thus, very few programmers truly "know C++". Instead, they have "used a small portion" of C++. For this reason, good C++ programmers tend to specialize specifically in C++ because it is such a large language with an extensive learning curve. In the past when I needed a component to be written in C++, I tended to farm it out to an expert who does C++ all the time, rather than attempt it myself.

You need to learn about memory management and memory usage in either C or C++--because the issues there are the same, whether you use the additional capabilities and libraries of C++ or not. And also, you need to learn how to do good object-oriented programming. But IMO (and the opinion of many computer scientists), it is not desirable to create many new OO designs in C++ if you can, instead, use one of the improved languages. Even if you need libraries already written in C++, those can be called from the newer languages (assuming you really know what you are doing).
 

Related Threads on Which one [language] next?

Replies
2
Views
6K
  • Last Post
Replies
8
Views
3K
Replies
15
Views
6K
  • Last Post
Replies
19
Views
1K
Replies
3
Views
1K
Replies
6
Views
2K
Replies
7
Views
4K
Replies
26
Views
6K
Replies
11
Views
3K
Replies
1
Views
1K
Top