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!

Value of programming and cs to an aspiring physicist

  1. Apr 22, 2009 #1
    Hi All,

    First post but have lurked for a couple of months. I am an undergrad majoring in physics. My question is this: I have a few holes in my schedule to fill and am considering taking a few programming courses and I am wondering a) of how much value is the ability to program (or at least understand the principles of programming and cs and/or the ability to read code) to a working physicist and b) is the ability to program a bonus when applying to grad school or looking for research opportunities?

    Thanks for your input and insight,
  2. jcsd
  3. Apr 22, 2009 #2
    I was shot down for a couple of undergrad research positions by professors because I didn't have any programming experience. It just depends what they need you to do.
  4. Apr 22, 2009 #3
    Your going to have to learn to program sooner or later so you mine as well do it now. But don't take classes for it though, they will only slow you down and waste your money. The fundamentals of programming isn't difficult to understand and most popular languages are very well supported. I suggest starting with MS Visual Studio Express: http://www.microsoft.com/express/product/default.aspx
    Last edited by a moderator: Apr 24, 2017
  5. Apr 22, 2009 #4


    User Avatar
    Science Advisor
    Education Advisor

    I suspect you already know the answer depends on what area of physics you go into.

    In my opinion, the ability to program is a very valuable skill. Depending on the nature of your research, you could end up looking into problems that involve a lot of simulation, or you could simply want to use a platform like MATLAB to analyze the data from your experiments. Many students who don't have the formal training tend to pick up what they need along the way. In my opinion, that leads to bad habits, misunderstandings and inefficiency in your work. I know that others would argue that some programming courses spend far too much time on irrelevant details and they would have a valid point.

    The other thing to consider is that programming is a marketable skill that can open up a lot of doors should you decide that academia isn't for you. The advantage physics students have over CS graduates is that they often are able to solve problems CS students can't. This also relates to your second question. A lot of research opportunities at the undergraduate level are essentially boased on programming skills.
  6. Apr 22, 2009 #5
    I am not a physics student. I am, however, a computer science student. But even though I am not a physics student, I take it that it would be a bad idea not to learn at least one programming language. Classes can be helpful if you don't have the drive to study without assignments. But you know better than I do whether you should take a class or study own your own.

    Here is where I stand on a few languages, though, as you will no doubt soon see, there are many opinions and no two or alike, or at least tend not to be. First off, if you are taking a class, study the language that will be used there, as it will give you a head start.

    Now, on languages: I am personally not a fan of the Java programming language, but it is quite popular these days (I am more interested in using the JVM with a language like Clojure, a lisp dialect). I am a fan of C++, but it has a lot of well-documented problems, and can be difficult to learn. But for lower-level programming in the physics world, I suggest either C++ of Fortran, as they seem to be popular. I do not yet know Fortran, so I can't comment on it in detail, but the things I have read about the language are favorable.

    I, and a few other people I have noticed on this forum, believe that understanding programming concepts is more important than knowing any particular language. The thing is, there are many paradigms in the programming world. Since object-oriented is the most popular these days, and many physical systems are easier to think of as objects, I don't think it would be a bad place to start. OOP does have its problems, however, and if you desire to become a better programmer later down the road, you may want to look into applying concepts of functional programming to your language of choice (you don't have to use a pure functional language to use the concepts). I am new to the concept myself and can't say too much on it.

    I am falling in love with Ruby, but it is "slow" and not as widely used in the physics world. Python is faster and used a lot in physics. I only have a basic understanding of Python, but I would recommend it as a first language because of the ease to learn, the fact that it is used quite a bit in physics, and because of it's extensive libraries. It is a very nice language in my opinion, though there are some things about it that irritate me; nothing worth of discussion, however.

    It is impossible for me to tell you what the "right" language for you is, because I do not know how your mind works. There is a good chance that the first language you choose will not end up being your preferred language in the end. My advice it to look around, choose a language you like the idea of, and learn it. Then try something else, or don't. I am not going to advise all sorts of advanced things you "should" learn, because that is up to you. You may hate programming and only wish to use the language you have just learned or the language used by the department you work in, or whatever. And that's fine. I like programming, to a degree, but I do not everyone needs to know as much about it as I would like to. I am not going to say "learn assembly, to will understand the machine better, blah blah blah." Truth is, you don't need to know assembly to programming. In my opinion, my work with assembly did help my understanding of computers and whatnot, but I don't have to know those things.

    So, in summary, my advice is that you should learn a language, but it is up to you and your circumstances to decide which one. Hope this helps; just noticed I am late for practice, so no editing.
  7. Apr 24, 2009 #6
    I've read a lot of comments that said "Don't take a programming class because it's easy and waste of time", but for some reason I found that understanding the fundamental of programming to be somewhat challenging. Maybe it's because of the course I took.I took the first quarter of Intro to CS sequence, which is usually taken by a CS major who had some programing experience before. I was not a CS major, and I've never programmed anything before. But I felt like I learned a lot from that class, and nothing about that class was "a waste of money". If you know a language already, however, you might be able to pick another language by simply reading a book. But I don't think it's a bad idea to take a class if you don't know any language.
  8. Apr 24, 2009 #7
    Introductory programming classes are easy, but are not a waste of time. Plus, they usually form chains. If you have 3 holes to fill, you can do the 1-2-3 sequence, and this will probably get you up and running in Java & C++ pretty quick.

    I think it's a little haughty to say that intro programming classes are easy, that the material can be learned on your own, and that needless time is spent on details. The same could be said of introductory courses in all disciplines, including Physics and Mathematics, where the introductory courses usually include something like "Jay Leno Physics", "Introductory General Physics I", "Introductory General Physics II", "College Algebra", "Pre-Cal", "Introductory Calculus I", "Introductory Calculus II", ...

    You can learn calculus from the Cliff's Notes book, but does that give you a good understanding of basic calculus? The analogy should be fairly straightforward.
  9. Apr 24, 2009 #8

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    I disagree. While learning to hack and slash is extremely easy, learning the fundamentals of programming is rather difficult and requires multiple classes. Engineers and scientists, in my experience, are generally quite lousy at programming because they don't know how to do it right. (The flip side: computer scientists are even worse at understanding engineering and science than are engineers and scientists at programming.) To have an inkling of how to do it right you need to know a bit about data structures, and algorithms, and software engineering.

    I elided the first part of Choppy's excellent post. I want add a bit to this latter part. A scientist or engineer who is adept in their primary field and who knows the fundamentals of programming is worth *a lot* for the simple reason that there are very few people with such skills. You will not learn these fundamentals in one class.
  10. Apr 24, 2009 #9
    "computer scientists are even worse at understanding engineering and science than are engineers and scientists at programming"

    I'm a computer science and physics double major, and my real passion is for CS - I want to be a computer scientist. And I'm one of - if not the - top students in the physics department. So while generalizations might be nice to make, I just thought I'd point out they mean little on an individual level.

    How did I get to be good in Physics? Easy - I took physics classes. Duh. If you want a solid understanding not only of programming but of the theory behind computing things, you're ignorant if you think that courses in the CS department are a waste of time.
  11. Apr 24, 2009 #10
    Hey, computer scientist here! But seriously, I agree with your fundamental point D H: it is difficult to learn to program properly. I wouldn't say it requires multiple classes, but I would say they are a good idea and definitely not a waste of time (unless you already know a topic front to back). I am mostly a self-learner - it's just how I work - but I do not tend to preach against classes.

    It seems the arguments here are black and white: either classes are a waste of time or they are completely necessary. I believe it depends on the person. I think that I could learn everything I am learning in college from books themselves, but that is not how I personally want to go about it. I prefer to take classes but always study up on a subject before the class itself. This helps place the ideas in my head more firmly. I recommend this method.

    But really this discussion is moot because svs3 needs to fill some slots for classes and obviously wants to take classes. And I think we all agree that it would be a good thing for her/him to learn computer programming. Thus, given the holes in svs3's schedule, the best advice seems to be, yes, take a programming class or three.
  12. Apr 24, 2009 #11

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    We get their resumes all the time from computer science graduates who took the minimum requirements in science and math and got lowish grades in those classes to boot. They might have made solid As in their computer science classes. Those computer science skills (logic) do not correlate all that well with the physical reasoning skills (analysis) needed for developing physical models. Logic and analysis are different skills, different mind sets. Some people are adept at both, and those who are, such as you, are golden.

    Can you learn this stuff (how to program well) on your own? Of course. One of the most valuable skills of all is the ability to learn something on your own.
  13. Apr 24, 2009 #12
    Yes, but it's misleading to talk about how easy programming is to learn by yourself. You could teach yourself everything in any introductory physics sequence in about a month... and I learned everything we covered in the regular (read: math major) Calculus I and II sequence from a Cliff's Notes style manual in about 2 weeks. The point is that you can learn most basic things on your own... and knowing how to program a summation or two (or, God help you, a recursive function or something) in C without classes is... well... basic.

    IMHO, it's the upper-level courses that are usually worthwhile in the sense that the professor can actually cause you to learn more than you would on your own. True, even the introductory classes are worthwhile because they fill in the details, make you do problem sets you may not otherwise do, and presents a more structured view of the basics. But knowing the content of an introductory sequence in programming is no more or less sufficient for the aspiring programmer than is the introductory sequence in physics for someone doing physical modeling or the introductory sequence in calculus for someone who needs to understand how numerical modeling works.
  14. Apr 24, 2009 #13
    I've taken a fair share of CS courses and I've come to the conclusion that learning to hack something together in a programming language is fairly easy, learning to do it well takes time, but taking a course that teaches the fundamentals of algorithms and data structures (as opposed to simply "programming") is invaluable.

    Find a course that attempts to teach you computer science principles such as recursion, various algorithms (sorting, search, etc.) and data structures (trees, graphs, etc.) and you will get quite a bit from the course. Make sure that you are required to program in the course (the language isn't as important since they change with time, but if C++/JAVA is being used, you are more likely to be able to apply what you learn more directly later) but that the details of the language are not the primary goal; but that some fundamental theories of CS are.
  15. Apr 24, 2009 #14

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    I guess I didn't make myself clear in my first post. One cannot learn the fundamentals of programming in one class. It takes a lot more than that. Introduction to computer programming (or the equivalent) does not include data structures and algorithms, principles of programming, and software engineering, each of which is very useful to the scientist or engineer who has any inking that their career will involve computer programming.
  16. Apr 24, 2009 #15
    Thanks a lot for all the input. This makes sense. My initial inclination is to take c++ as that seems to be the most flexible though harder than a lot of others. And learn python on my own. Any thoughts?
  17. Apr 24, 2009 #16
    I think that will be fine. C++ is a great language. In case you would like any recommendations for texts: I really like C++: How to Program (I own the 5th edition, but I am sure others are fine); I haven't gotten through How Not to Program in C++ yet, but it looks great, and will help you learn to write clean, well-formed code. In addition, I also hear great things about Accelerated C++, but I do not own it. And with python, the language itself is so simple to grasp that it is just as easy to learn from online than from a book. I recommend: http://www.ibiblio.org/swaroopch/byteofpython/files/120/byteofpython_120.pdf" [Broken]. If you are like me and prefer to read from paper, you can print this one. Good luck.
    Last edited by a moderator: May 4, 2017
  18. Apr 25, 2009 #17
    I'm a computer science-type heading into physics, and I've got to say, I'm not at all sold on the idea that C++ is an essential skill unless you have ambitions in computational physics. A little MATLAB will take care of most things you'll probably need.

    I occasionally have to hang a few pictures on the wall, so I bought a hammer, not a pneumatic nail gun.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook