What are the advantages of learning C++ as a first programming language?

Click For Summary

Discussion Overview

The discussion revolves around the advantages and considerations of learning C++ as a first programming language, with comparisons to other languages such as Python and Java. Participants explore the suitability of various languages based on their personal experiences and intended applications, touching on aspects of syntax, learning curves, and specific use cases.

Discussion Character

  • Debate/contested
  • Exploratory
  • Technical explanation

Main Points Raised

  • Some participants advocate for Python as a beginner-friendly language due to its simplicity and ease of learning.
  • Others argue that C offers a deeper understanding of programming concepts and computer operations, making it a valuable language to learn first.
  • There are mixed opinions on the necessity of learning C before C++, with some suggesting that prior knowledge of C enhances the understanding of C++.
  • One participant mentions that learning Java can also be beneficial, particularly for high-level programming tasks, despite it being perceived as slower than C.
  • Some participants express that the choice of language should depend on the individual's goals and the specific applications they intend to pursue.
  • There are suggestions for resources and tools to use when learning C, including dual-booting systems and specific programming books.
  • Participants note that the programming community often has varied opinions on the best language to learn, highlighting the subjective nature of the discussion.

Areas of Agreement / Disagreement

Participants do not reach a consensus on which programming language is definitively the best to learn first, as multiple competing views remain. The discussion reflects a variety of preferences and experiences, indicating that the choice of language may depend on individual goals and contexts.

Contextual Notes

Some participants express uncertainty regarding the best version of Python to start with and the appropriate compilers for different languages. There are also references to the learning curves associated with C and C++, suggesting that these factors may influence a learner's decision.

Who May Find This Useful

This discussion may be useful for individuals considering which programming language to learn first, particularly those interested in programming for scientific or engineering applications, as well as those weighing the pros and cons of different languages based on their personal or professional goals.

QuarkCharmer
Messages
1,049
Reaction score
3
I just finished all of my finals today, and now the summer is here! I am in a REU for the semester, and I should have plenty of time to learn a programming language. So, this afternoon, I googled around a bit for information... and I can't figure out what to do! I was debating on Java, Python, or C/C++. I was going to first check out Python since I know it's sort of a user-friendly first-language option, but there are so many versions of the language, and just so many compilers...

Someone help me out here, what specifically should I be looking for? If I search amazon for a programming book, there are many different ones on different versions of each language. Is python a good place to start, and if so, what is the current version and which compiler is worthwhile? If not, then the same question about the suggested language.

Thanks!
 
Technology news on Phys.org
I will always recommend Python as a starting programming language. It's so easy to pick up in comparison to others languages, mostly because of syntax and less tech jargon. Plus they have an awesome tutorial here:

http://docs.python.org/tutorial/

It doesn't really matter which version you download just make sure there is a tutorial for it and you're good. Good luck.
 
Thanks DA.

I actually have some experience with programming. Specifically using C# for what it's worth, and I was a professional with Adobe/Macromedia Actionscript 3.0 and prior some time ago, though that's not entirely related. The tech-stuff wouldn't bother me too much. I know the basics of programming already, would python still be a good start? Or should I concern myself with one of the C's.
 
Well, IMO, it depends on what you are planning to do with the language.

As DA said, Python is always a good first language. In fact, scripting languages tend to be good first languages as they allow you to get your feet wet. My first was Java. Java has its uses and it a good language, but I prefer C. C is a really great language but it comes with a steep learning curve. Also, C++ is great and you don't really need to know C to learn C++ (though you will appreciate C++ much more if you already know C.) I also know a little MATLAB and fortran. These are really great if you are doing some sort of scientific/numerical programming. Matlab takes care of a bunch of stuff that is hard in C. As a specific example, doing matrix multiplication is trivial in MATLAB but not so much in C (it isn't very hard, just sort of tedious.)

To answer your question, I like C. I'd learn C because if you know C, it will be relatively easy to learn other languages. The only downside is that C is not Object Oriented (well, it does not naturally support Objects) whereas Java and C++ are. However, I don't think this is a huge disappointment.
 
What really makes C better than Java? OOP is pretty helpful. I was under the impression that Java can do basically everything C can, perhaps slower. I'm not looking to make some awesome optimized code. I was looking to learn some basics and then try to make a line integral calculator or something as a first project.
 
Ahh gotcha. I know C fairly well but I would rather code in Python although since I'm an EE major, C is the most useful for me to know. I have no experience with Java and barely any with C++ so I can't comment on those.

Here's some free books with numerical applications I've found:

http://www.nr.com/oldverswitcher.html

Google "Numerical Methods for Python" and you'll find another free book

I guess it depends on what your eventual goals are. For me, I found that a research group I'm interested in uses C++ extensively so this summer C++ and numerical methods is on the to-do list. :smile:
 
QuarkCharmer said:
What really makes C better than Java? OOP is pretty helpful. I was under the impression that Java can do basically everything C can, perhaps slower. I'm not looking to make some awesome optimized code. I was looking to learn some basics and then try to make a line integral calculator or something as a first project.

Java is really great. It allows for pretty robust code and it allows developers to think very high-level. Additionally, it can be very useful when you have to deal with matricies and vectors (though MATLAB is still much better.) This is because the Java takes care of a lot of the underlying details of array implementation.

I suggested C simply because I like it more, and for several reasons. 1) It is what a programming language "should" be. That is not to say that there aren't problems. 2) Knowing C will really help you understand stuff in other languages. For example, when I was learning Java, I had no idea what a pointer was, but everyone kept saying "object names are pointers to data, not the actual data" I didn't really get what this was about until I learned C. 3) To know C, you have to learn more about how a computer works, specifically with respect to how memory is organised and used. 4) If you get to know C, then you will be able to talk intelligently about pretty much every other language. That's not to say you will know every other language. 5) Pointers are a really great feature of C and, for me, are the only things that I miss in Java. 6) IMO, knowing C is kind of like knowing Algebra: It might not be directly applicable to whatever you are doing, but you get a good glimpse of what is happening under the hood, specifically when you are wanting to analyse algorithms.


Additionally, it is sort of like a language that everyone should know (all technical people, that is.) Again, not really because you will "need" to use it, but more for the same reason we read novels by Charles Dickens, and others.


So, these are the reasons I suggested C. However, learning Java would also be a really good idea. Once you have learned your nth language, the (n+1)th is easier to learn. So, it might be wise to learn something like Java or Python, and then learn C.


But, like I said, most of it depends on what you are going to be doing. For example, I used Java for one project and C for another. Sometimes when I am doing numerical stuff I use C, sometimes matlab, occasionally Java or Fortran (usually those two to keep my skills semi-sharp, but they aren't too sharp and never have been with Fortran.) But, for a general purpose language, I will always go with C.
 
Oh, if you decide to learn C, I suggest a few things:

1) Make your computer a dual boot with Windows / Linux (preferably Ubuntu)
2) Code on the Ubuntu side and us the gnu c compiler (this comes with Ubuntu)
3) Edit code in Vim (or, if you are *evil* you could use Emacs) in the command prompt
4) Get the books: The Unix Programming Environment (nearly all of it will be applicable to your Ubuntu box), A Book On C (the one by Kelley), The C Programming language (by K&R).

This also has a pretty steep curve, but learning to program in a text editor (as opposed to an IDE) will help you learn the language better. Also, once you start editing in vim (or the evil emacs) you will not want to go back to any "regular" text editor.
 
Ask four programmers which programming language to learn and you'll get at least six recommendations. :smile:
 
  • #10
I like the standard C Python. There's a great standard library, then add NumPy/SciPy/matplotlib and you're good.

Compiled languages, go* C and gcc.

*As in the verb 'to go', but the Go language looks rather interesting.
 
  • #11
jhae2.718 said:
I like the standard C Python. There's a great standard library, then add NumPy/SciPy/matplotlib and you're good.

Compiled languages, go* C and gcc.

*As in the verb 'to go', but the Go language looks rather interesting.

What do you mean by gcc? That's not a language; that's a compiler for C. I'm guessing you just meant "go, or C with gcc" is that correct?
 
  • #12
I mean write C and compile with gcc.
 
  • #13
jtbell said:
Ask four programmers which programming language to learn and you'll get at least six recommendations. :smile:

Haha, yes.
QuarkCharmer, the most important thing is that you know how to program generally. Any of the languages you and others have suggested so far would be fine. At the end of the day, you'll need to learn multiple languages anyways, so I would recommend picking one language and sticking with it for a while so that you can learn how to program well. After this you can pick up other languages as you need them. You'd even be fine sticking with C# for now, if you already have some experience with it.

I learned Java first, because that's what was taught at my university. In practice (I'm a student working on projects in computational solid state physics), I use some combination of fortran, perl, mathematica, and tc shell scripting.
 
  • #14
Hey QuarkCharmer.

My recommendation is that if you have learned C#, you might as well learn C++. Learning all the intracacies with templates, class construction, inheritance (you can do multiple inheritance as well but it's not recommended in most situations) as well as basically going down to the bone in terms of memory management, debugging, and also since you can use DLL's compiled from any language, you get to work with trans-language issues if you chose to do so, which is important for many legacy applications that use multi-language repositories.

Those are the big things IMO although there are more things in C++ aside from these and if you are interested in bare-bones OOP where you have to do most things yourself (and also work in a multi-language environment with say Fortran or Pascal DLL's from C++ environment or use some kind of custom SDK), then this would be a good language to learn.
 

Similar threads

Replies
86
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 397 ·
14
Replies
397
Views
21K
  • · Replies 25 ·
Replies
25
Views
1K
  • · Replies 133 ·
5
Replies
133
Views
12K
Replies
16
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 15 ·
Replies
15
Views
4K
Replies
6
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K