Next Language: Java, C, or C++?

  • Thread starter sarvesh0303
  • Start date
  • Tags
    Language
In summary: Java and other languages are designed to be more user-friendly from the get-go, so the new programmer doesn't have to learn all those basics first.In summary, C is the best language to start with, followed by Java.
  • #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)
 
Technology news on Phys.org
  • #2
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
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
Thanks!
 
  • #5
I third that suggestion. Learn C, then learn Java. Good luck.
 
  • #6
phinds said:
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
AlephZero said:
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
I agree with Phinds. I learned C and knowing pointers did not slow me down in any way for learning Object Oriented Programming.
 
  • #9
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
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
AlephZero said:
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
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
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
c# or java/scalar then c++
 
  • #15
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
Superposed_Cat said:
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 don't know about pythn have only done super simple calculating things in it.)
 
  • #19
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
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 won't 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 learned it because we had to at high school.
 
Last edited by a moderator:
  • #23
Superposed_Cat said:
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
Superposed_Cat said:
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 don't know 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 ...?

Superposed_Cat said:
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
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
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
looks like the thread has run its course and should be closed now.
 
  • #28
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
Superposed_Cat said:
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
voko said:
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
jedishrfu said:
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
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
Superposed_Cat said:
And windows

Which version of Windows is coded in C++? What is the source of your information?
 
  • #34
Superposed_Cat said:
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
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

1. Which programming language is more popular, Java, C, or C++?

According to the TIOBE Index, Java is currently the most popular programming language, followed by C and then C++. However, the popularity of programming languages can fluctuate over time.

2. Is Java easier to learn compared to C and C++?

Many people consider Java to be easier to learn than C and C++. This is because Java has a simpler syntax and does not require manual memory management like C and C++ do. However, this can vary depending on the individual's learning style and background.

3. Which language is better for developing mobile applications, Java, C, or C++?

Java is the most commonly used language for developing Android applications, while C and C++ are often used for developing iOS applications. However, there are other languages, such as Swift, that are specifically designed for mobile development.

4. Can you use all three languages for web development?

Yes, all three languages can be used for web development. Java can be used for server-side programming, while C and C++ are often used for developing web applications that require high performance.

5. Which language is better for game development, C or C++?

Both C and C++ are commonly used for game development, as they offer low-level control and high performance. However, C++ is often considered the better choice due to its object-oriented features and more modern syntax.

Similar threads

  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
8
Views
874
  • Programming and Computer Science
Replies
11
Views
1K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
14
Views
2K
  • Programming and Computer Science
Replies
1
Views
726
  • Programming and Computer Science
Replies
5
Views
942
  • Programming and Computer Science
Replies
16
Views
1K
Back
Top