Which one [language] next?

  • #1
sarvesh0303
61
2
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
2021 Award
17,917
10,157
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,657
3,563
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.
 
  • #4
sarvesh0303
61
2
Thanks!
 
  • #5
MrTheBard
29
3
I third that suggestion. Learn C, then learn Java. Good luck.
 
  • #6
AlephZero
Science Advisor
Homework Helper
7,025
297
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
2021 Award
17,917
10,157
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
MrTheBard
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,450
687
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
325
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
voko
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
619
158
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
13,925
7,873
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.
 
  • #14
Superposed_Cat
384
5
c# or java/scalar then c++
 
  • #15
Daverz
1,000
72
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
Superposed_Cat
384
5
Why learn C if C++ exists? Not to be obnoxious or malicious...
 
  • #17
D H
Staff Emeritus
Science Advisor
Insights Author
15,450
687
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
Superposed_Cat
384
5
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
voko
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
Superposed_Cat
384
5
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,450
687
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
Superposed_Cat
384
5
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
Daverz
1,000
72
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
36,335
8,294
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
619
158
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).
 
  • #26
Superposed_Cat
384
5
C++ is not a replacement for C. It didn't make C obsolete.
It has al the hardware power you could ever need and plus its object orientated.

C++ is not "easier" than C. It adds a huge amount of complex syntax.
I think it's power to complexity ratio is nicer.
you don't even get automatic memory management.
I like that. It "trusts " you in a way. you can do things that ordinary languages won't let you do because of it.

And it's certainly not more common than C.
true but the things coded in c++ are. os's, anti-viruses, most software.

Hell the OP didn't even say what he wanted it for. Unless he specifies he should just do hello worlds in each language and see which he prefers.
 
Last edited by a moderator:
  • #27
13,925
7,873
looks like the thread has run its course and should be closed now.
 
  • #28
voko
6,054
391
C++ is not a superset of C. There are valid C idioms that are not C++. For example, a pointer to void in C can be assigned to a pointer to any type without an explicit cast. Certain things, while valid in both languages, work differently. For example, character literals are int in C, and char in C++.

I should say that the latest flavor of C++ goes a long way toward making C++ less "troublesome object-oriented programming language". http://isocpp.org/tour

It is too bad that many students today are still forced to learn the old version.
 
  • #29
voko
6,054
391
true but the things coded in c++ are. os's, anti-viruses, most software.

This is a ridiculous statement. Name at least one popular OS coded in C++.
 
  • #30
13,925
7,873
This is a ridiculous statement. Name at least one popular OS coded in C++.

Well, Taligent OS was coded in C++. Unfortunately, it never made it out in the wild except as a reference platform for developers after Apple pulled out of the project. It was originally named the Pink OS after Apples use of blue cards for features to go into the next release and pink card for some future release. Apple created a consortium of Apple, IBM and Motorola (the AIM Alliance) and a company Taligent (Talent without MS Windows NT and Intelligent without Intel) to write it for the IBM/Motorola PowerPC chip.

It took OO principles to the max. They even wrote a few books on it and on the programming style used. It was a challenging system to develop on considering Eclipse/Netbeans tool weren't yet available only docs and layer upon layer of class hierarchy.

see http://en.wikipedia.org/wiki/Taligent
 
  • #31
voko
6,054
391
Well, Taligent OS was coded in C++. Unfortunately, it never made it out in the wild except as a reference platform for developers after Apple pulled out of the project.

That isn't exactly what I would call "popular".
 
  • #32
Superposed_Cat
384
5
And windows

That is the dominant OS where I come from. Mac users are frowned upon for only using one button,

Oh. another advantage is that c++ is on the dot net framework so it will run on Xboxes, windows an windows phone. c++ also goes straight to the cpu or something (I heard it works a lot faster because of this).
 
Last edited by a moderator:
  • #33
voko
6,054
391
And windows

Which version of Windows is coded in C++? What is the source of your information?
 
  • #34
voko
6,054
391
Oh. another advantage is that c++ is on the dot net framework so it will run on Xboxes, windows an windows phone. c++ also goes straight to the cpu or something (I heard it works a lot faster because of this).

While there is a non-standard version of C++ that works on top of the .net CLI, that is not true of the standard C++.

Standard C++ compilers do typically generate machine code, even though the GNU compiler also supports a virtual machine.
 
  • #35
D H
Staff Emeritus
Science Advisor
Insights Author
15,450
687
Thread closed. There is far too much misinformation in this thread as of late, and the discussion has verged very far from the original topic.
 
  • Like
Likes 1 person

Suggested for: Which one [language] next?

Replies
30
Views
1K
Replies
21
Views
324
Replies
8
Views
347
Replies
397
Views
9K
Replies
32
Views
604
Replies
14
Views
421
Replies
10
Views
349
  • Last Post
Replies
7
Views
593
Replies
28
Views
1K
Top