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

In summary: But it is a great foundation from which to work. 2) It is more versatile. You can do a lot with C than you can with Java. 3) It is less popular. This might not be as important to you, but it is an advantage to have less competition.
  • #1
QuarkCharmer
1,051
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
  • #2
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.
 
  • #3
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.
 
  • #4
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.
 
  • #5
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.
 
  • #6
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:
 
  • #7
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.
 
  • #8
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 Langauge (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.
 
  • #9
Ask four programmers which programming language to learn and you'll get at least six recommendations. :rofl:
 
  • #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. :rofl:

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.
 

1. What is "Specific programming language" and what is it used for?

"Specific programming language" is a computer programming language that is designed for a specific purpose or application. It is used to write code that instructs a computer to perform specific tasks, such as creating software, websites, or mobile applications.

2. Is "Specific programming language" easy to learn?

The difficulty of learning "Specific programming language" can vary depending on an individual's prior experience with other programming languages and their level of dedication to learning. Some people may find it easier to learn compared to others, but overall, it is considered a user-friendly language with a relatively gentle learning curve.

3. What are the main features of "Specific programming language"?

Some of the main features of "Specific programming language" include its simplicity, high-level language structure, and object-oriented programming capabilities. It also has a vast library of built-in functions and a thriving community of developers who contribute to its continuous development.

4. Can "Specific programming language" be used for different types of applications?

Yes, "Specific programming language" is a versatile language that can be used for a variety of applications, including web development, game development, data analysis, and artificial intelligence. Its flexibility and broad range of libraries make it suitable for many different programming needs.

5. How can I get started with learning "Specific programming language"?

If you are new to programming, it is recommended to start with online tutorials, courses, or books that provide a step-by-step guide to learning "Specific programming language". You can also join online communities and forums to connect with other developers and ask for help and advice. Practice and hands-on experience are key to mastering any programming language.

Similar threads

  • Programming and Computer Science
Replies
8
Views
875
  • Programming and Computer Science
4
Replies
107
Views
5K
  • Programming and Computer Science
12
Replies
397
Views
13K
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
11
Views
1K
Replies
6
Views
1K
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
2
Replies
65
Views
2K
  • Programming and Computer Science
Replies
2
Views
1K
Back
Top