C/C++ Learn C++ for Physics & Astronomy: Books & Tutorials

  • Thread starter Thread starter aftershock
  • Start date Start date
  • Tags Tags
    Teaching
AI Thread Summary
A user preparing for a computations course in physics and astronomy seeks advice on learning C++ with no prior programming experience. Recommendations include a specific book that is beginner-friendly and thorough, along with online tutorials. Some participants suggest that instead of focusing solely on C++, it may be beneficial to learn programming concepts through simpler languages like Python or C#. The discussion emphasizes the importance of practical experience in programming, arguing that one cannot truly learn to program without actively coding. There is a debate on the distinction between "coding" and "programming," with some asserting that understanding programming principles is crucial for effective coding. Overall, the consensus is that while learning a specific language is necessary, grasping broader programming concepts and gaining hands-on experience is essential for success.
aftershock
Messages
106
Reaction score
0
I'm taking a computations for physics and astronomy majors course next semester and was told it'd be a guide idea to try and learn some C++ before starting the course. I have absolutely zero programming experience and plan to spend this winter break trying to learn some C++

Any recommended books or tutorial websites? Thanks.
 
Technology news on Phys.org
Get this book:
https://www.amazon.com/dp/0672326973/?tag=pfamazon01-20

It assumes you haven't programmed before and is easy to read. Very thorough on all subjects but quite lengthy (1200 pages). You might be able to read tutorials online http://www.cplusplus.com/doc/tutorial/"e, but it might be difficult to decipher for a first time programmer.
 
Last edited by a moderator:
You don't even need a book for this. I went through online tutorials for it, did a little extra practice, and did great in my C++ classes.

http://www.cprogramming.com/tutorial.html#c++tutorial

That's where I started. Once you have a grasp of it, do a Google search for more advanced C++ projects or check out Project Euler for more practice.
 
I think you would be better served to spend your time learning how to program rather than one particular language.
 
Vanadium 50 said:
I think you would be better served to spend your time learning how to program rather than one particular language.

I am always baffled by this. How does one learn how to program without starting with a particular language? You can read a book on programming in general, but how do you *practice* programming without actually programming?
 
I agree with V50. C++ is a huge language, which can support just about every possible style of programming (including the styles that should be buried with a stake through the heart IMHO). Unless you have a map of the forest before you start, you will probably get lost somewhere among the 2^16 (or maybe 2^64) different species of trees.

You would be better first learning to how PROGRAM, in a cleaner-designed language like Python, or C# if you want something that looks more like C++.

Learning the syntax of a new programming language is no big deal, if you already know what you want to say in it. I've learned a new language every 1 or 2 years (from necessity, not personal choice) during my working life - and forgotten most of the details of at least 15 of them!
 
I'm no expert in programming by any means, as I only have a semester's worth of doing so in Java under my belt, but it still seems to me the best thing to start programming is to start programming in a specific language. When a book has hundreds of pages, I'm pretty sure it also has introductory chapters that can serve as a welcome to all programming languages, not just the one you're learning. I mean, this might be a bad analogy, but how do you learn how to drive a car if not by driving a specific car of specific build?
 
Rather then jump straight into object orientated programming and the nastiness of inheritance and parameter passing would strongly recommend starting with BASIC.

You cannot learn to program by reading about it you must do it.
 
AlephZero said:
I agree with V50. C++ is a huge language, which can support just about every possible style of programming (including the styles that should be buried with a stake through the heart IMHO). Unless you have a map of the forest before you start, you will probably get lost somewhere among the 2^16 (or maybe 2^64) different species of trees.

You would be better first learning to how PROGRAM, in a cleaner-designed language like Python, or C# if you want something that looks more like C++.

Learning the syntax of a new programming language is no big deal, if you already know what you want to say in it. I've learned a new language every 1 or 2 years (from necessity, not personal choice) during my working life - and forgotten most of the details of at least 15 of them!

People have yet to explain how you learn to program without *actually programming.* I am still curious as to how one does this.
 
  • #10
Saladsamurai said:
People have yet to explain how you learn to program without *actually programming.* I am still curious as to how one does this.
You are making a red herring / straw man argument. Nobody but you has said to do what you said to do. What people have said is you should learn how to program rather than learning how to code. There is a world of difference between programming and coding. That scientists and engineers do not as a group understand the difference is illustrated by [thread=458470]this thread[/thread].
 
  • #11
To make an analogy, "coding" is to "programming" as "spelling and grammar" are to "writing a coherent and effective essay or book."

You need to learn how to code in some particular language, no doubt about that. But that's only the beginning. For example, don't just learn how to write functions, learn how to use them effectively, which involves thinking hard about how to organize your program into modular sections that exchange data in a limited and well-defined way. The general principles don't depend much on the particular language that you're using.

A lot of this comes from experience, and practice in experimenting with different ways of organizing your programs. Almost always, when I finish a non-trivial project, I can see ways that I could have done it differently and possibly better. Sometimes I actually have a chance to re-do the whole thing accordingly, which is a valuable learning experience.
 
Back
Top