1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Computer Science and physics?

  1. Feb 21, 2012 #1
    I am planing on taking physics as a major, and am also considering studying computer science on the side (my school offers a 5 year cs masters when your majoring in physics). The thing is, I know nothing about computers. I barely understand the difference in software and hardware. When I see an example of code, I am just baffled and don't get how so many people have caught on to such a concept while I have not even been aware of its existence!

    In any case, I am naturally attracted to things I don't understand. And so I can't help to humor the idea of taking computer science classes to see how I like it.

    But first, just thought Id ask and see if anyone has any suggestions on a book or website I might want to read first to determine if its something that would actually interest me. How much math is involved for introductory computer science? The intro course at my college uses a book called Big c++. If i get this book and read it on my own, would I be able to follow it and make sense of anything without being in a class?

    Thoughts? (Im 26 and in my first year of college by the way...Still trying to get a handle on what I want to do with myself in the long run...)
  2. jcsd
  3. Feb 21, 2012 #2
    You should be able to get the hang of the basics from the internet, try:


    To see if there is anything you like. In terms of mathematics you need to know the basics but it really depends on what your programming, of course a piece of drawing software needs geometry etc.

    As for Big C++ feel free to read it, but try not to get caught in the trap of thinking "I know C++!" because you may know the syntax but without the understanding of the concepts its virtually worthless. Think "I am a programmer, I know how to make computers do what I want, It does not matter which language". For example arrays are similar in most all languages I have come accross, when you get a problem and realise you need an array you would go look of the syntax for your paticular language that your using (This might not make sense until you know what an array is, sorry!)

    Hope this has helped.

    P.s if you do get into programming I recommend "The Pragmatic Programmer" book. Very good!
  4. Feb 21, 2012 #3


    User Avatar
    Science Advisor

    Hey zoiberg137 and welcome to the forums.

    For CS, one of the major components is programming which is what I used to do for money for a little while. You can learn it just like learning to drive a car for the first time or learning how to play a sport: it focuses on different things but the point is you can learn it.

    Here is some advice for you to keep in the back of your mind when you are dealing with any kind of programming:

    Be aware of two things: state and flow-control.

    State just means every bit of data and information in memory that you use in some form and flow-control has to do with how data gets processed and in what way. Lets make these comments less confusing:

    When you start programming you'll do simple programs like set an integer to a value, print a simple sentence on the screen amongst other things.

    The most important thing that you will have to learn is how to track the state of your program. You will start with simple short pieces of code but it will get a lot larger and you will have to manage the states in your head using good coding techniques and all the stuff that you will taught in your CS courses.

    You will learn a lot of different techniques and if you understand how to track the state of all these different things then it will be easier for you to really understand what is going on and also when you have to debug your code (which can be a nightmare). If you know whats going on with the state of each variable and the state of the overall runtime environment (for now just think inside your program), then it will make your job a breeze in comparison to if you did not.

    Now comes flow-control.

    With flow-control you will be no doubt introduced to procedural and quite possibly object-oriented paradigms like C or C++ if its OOP.

    The flow-control is basically a way to say how data gets processed and how that gets done. For a procedural language its basically going to be from top to bottom inside some context.

    A context is something like a loop or a function where once you've say called a function or you are inside a loop then you still go from top to bottom but its inside the loop or function until the loop ends or until you exit the function. Also with a loop if the condition isn't satisfied to end the loop you go back to the start of the loop and do the top to bottom thing again.

    Again you will start off with simple examples and build them up to things that are more complicated developing your ability to organize everything in your head over time.

    Flow-control and state have a very intertwined relationship: if you get a weird kind of error for a variable then knowing the flow-control will help you track the error down. For example you might be in a langauge like C++ and for some reason some hidden function gets called that doesn't do the right thing and you need to find this to fix your program.

    Keeping these two things in mind will put everything in perspective when it comes to writing code of any sort, in any environment and on every platform. The state and flow-control might be different paradigms or include different things but the idea itself does not change.

    I wish you all the best with your courses.
  5. Feb 21, 2012 #4
    The best book I have seen for teaching yourself C++, after having done C++ for over 12 years would have to be:

    C++ Without Fear: A Beginner's Guide That Makes You Feel Smart

    Its very good for beginners, and teaches all the right concepts in my opinion.
  6. Feb 21, 2012 #5
    If the class mostly deals with the syntax et al. of the langage, then feel free to use the book. Learning a programming language is something you can do by yourself, and I recommend doing just that.

    On the other hand, one doesn't learn programming by reading a book. You have have to actually *read* and *write* code. If the class is very programming-heavy, if there are loads of examples and exercises where you have to write new code, then by all means, go to the class. Or work on a project. But at least do anything other than just reading a book about the language and understanding those minimal examples.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook