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

  • Context: C/C++ 
  • Thread starter Thread starter aftershock
  • Start date Start date
  • Tags Tags
    Teaching
Click For Summary

Discussion Overview

The discussion revolves around recommendations for learning C++ in preparation for a course in computations for physics and astronomy. Participants share their experiences and suggest resources, while also debating the best approach to learning programming in general.

Discussion Character

  • Exploratory
  • Debate/contested
  • Technical explanation

Main Points Raised

  • One participant seeks recommendations for books or tutorials to learn C++ before starting their course.
  • Another participant recommends a specific book that is thorough and beginner-friendly, despite its length.
  • Some participants suggest that online tutorials can be sufficient for learning C++, citing their own positive experiences with them.
  • There is a viewpoint that emphasizes the importance of learning programming concepts rather than focusing solely on a specific language like C++.
  • Some argue that one cannot learn to program effectively without starting with a specific language, drawing analogies to learning to drive a car.
  • Several participants express concern about the complexity of C++ and recommend starting with simpler languages like Python or C# to grasp programming fundamentals first.
  • One participant highlights the distinction between "coding" and "programming," suggesting that learning to program involves deeper understanding and organization of code beyond just syntax.
  • There is a discussion about the necessity of practical experience in programming, with some questioning how one can learn without actual coding practice.

Areas of Agreement / Disagreement

Participants express a mix of opinions on whether to focus on a specific language or on programming concepts in general. There is no consensus on the best approach to learning programming, as differing views on the necessity of starting with a specific language versus broader programming principles are presented.

Contextual Notes

Some participants mention the potential challenges of learning C++ due to its complexity, while others emphasize the importance of practical experience in programming. The discussion reflects varying perspectives on the relationship between coding and programming.

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.
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
3K
Replies
69
Views
10K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 15 ·
Replies
15
Views
3K
Replies
5
Views
8K
  • · Replies 17 ·
Replies
17
Views
4K
Replies
1
Views
2K