1. Not finding help here? Sign up for a free 30min 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 = helpful?

  1. Nov 5, 2006 #1
    next year I can take European History AP or Computer Science (i think its AP but i'm not sure.)

    I would like to take history but i think computer science might be more helpful later down the road, i'd be fine with either

    will a physics/math major need computer science
     
  2. jcsd
  3. Nov 5, 2006 #2
    i would say yes. Its always helpful to know how to break a problem down and write code to solve it for you. I know lots of physics majors and they all know how to prorgram in some language. Not so much math majors though.
     
  4. Nov 5, 2006 #3
    If it's AP Computer Science, then it's java... Even if it's not AP, there is a strong chance that they teach Java and nothing else....

    I would take European History, if I were interested in it.

    People have said that Java is a horrible language to learn to program with. Also, as a physics major, you wouldn't learn Java (at least not at the universities I have looked at....). Generally, aspects of different programming courses apply to different languages, but ehhh...
     
  5. Nov 5, 2006 #4
    Java is an excellent language in my opinion out in the programming world Java ranked very high. Our whole university switched from C++ to Java because IBM asked Penn state why they are teaching us C++ when we want java programmers. Java is also very Object Oriented so when you program you don't have a mess of code thats hard to maintain or debug.

    Anywho, if you learn 1 language you can learn them all (unless that language is VB :P). C++ and java are closely related in syntax, because Java was made after C++, somtimes called C++ ++ or OAK then later renamed Java.
     
    Last edited: Nov 5, 2006
  6. Nov 5, 2006 #5
    Yeah, I agree, Java is an OK intro to programming language, but it's not an excellent language in general.
     
  7. Nov 5, 2006 #6

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    mr_coffee,

    I suggest you invest a week or two in learning Python, and then let us know what you think about quality of Java. ;) I used to be a Java cheerleader of the first kind, until I realized so many better options exist.

    - Warren
     
  8. Nov 5, 2006 #7
    I took AP computer science, took the AB test (harder of the two, and also probably hardest test i have ever taken)
    I loved the class but had a poor teacher. I had taken a class in java prior and the AP class was sort of an advanced java class at our school. I think java is a great language to learn, and is an easy language to learn as a beginner. I think it would be good to have some programming experience prior to your college career if you are planing on physics/maths because you will inevitably have to take an intro to programming course somewhere in your career as a physics or maths major.
     
  9. Nov 5, 2006 #8
    chroot, I never did any Python programming but from what you said I think i will! thanks!

    Is Python used out in the industry alot? I know alot of Linux stuff uses Python but when search monster.com and looking for internships I havn't seen any industrys saying Python is a plus to know or required.
     
  10. Nov 5, 2006 #9
    On a sidenote, my univ teaches an intro to computing class in python, but everything hence forth is taught in Java or C++ depending on the type of class with the exception of possibly Data mining classes. I would recomend Learning Java and Python simultaneously
     
  11. Nov 5, 2006 #10
    I wish my uni offered data mining....they do but its a friggin' grad student course. Can you take it in your 4 year?
     
  12. Nov 5, 2006 #11

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Python is rapidly gaining market share in the industry, from what I know -- but I work as an electrical engineer. It's really a computer scientists' dream language, as far as I'm concerned. I can literally program in Python as fast as I can think.

    Compared to C++: None of the 1,001 "gotchas" present in C++. No memory management woes. No architecture dependencies to worry about. Many, many libraries provided in the default install. Runs anywhere. No compilation necessary. Immediate mode execution means you can try things out in a sandbox before you actually code anything.

    Compared to Java: All of the advantages over C++, and more. No painful, rigid, redundant syntax. Easy inheritance, easy function semantics. Every keystroke means something. Python uses reflection at its core, while Java just tacks it on as a library. Dozens of brilliant syntactic devices (dictionaries, list comprehensions, lambda functions, duck-typing, etc.) that make data structure and algorithm design positively simple.

    Compared to Perl: Text-processing facilities that are just as powerful, yet don't rely upon stupid special variables like $_ and $@. Syntax that's easy to follow even in the densest circumstances.

    - Warren
     
    Last edited: Nov 5, 2006
  13. Nov 5, 2006 #12

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Keep in mind that learning a second language is much easier than learning a first language. So even if you never again use the language you learned in your first class, it still won't have been a waste of time.
     
  14. Nov 5, 2006 #13
    Wow it sounds pretty sweet, thanks for the info!
     
  15. Nov 5, 2006 #14

    -Job-

    User Avatar
    Science Advisor

    I know Yahoo uses some Python, i've seen some .py scripts on their site. I think google does as well for some of their stuff.
    I didn't know Python was interpreted rather than compiled.
    From your description chroot, Python sounds alot like Javascript, VBScript and PHP type languages, but more organized.
    By the way, C#, my fav language, also has reflection, plus alot of the nice Java features (very similar to java in organization). In addition it supports both manual and automatic memory management and can be compiled to run on a virtual machine or on native machine code.
    But the best language depends on your needs.
     
  16. Nov 5, 2006 #15

    0rthodontist

    User Avatar
    Science Advisor

    Maybe Python is a good language to write code in, but it can be very hard to read code in Python. Also it's pretty slow compared to Java. The main thing I like about it over Java is that it has higher order functions and lambda expressions. But I hear that they are taking a lot of that stuff out in the new version of Python, even the "reduce()" function for which there will then be no good alternative. I read that Guido von Rossum's justification for that is that he finds it hard to understand what a reduce() expression is doing unless he explicitly writes out the accumulation loop. GRR. Maybe he just never had a good course in functional programming, because a reduce() expression is much quicker and clearer than an accumulation loop, when appropriate. He shouldn't penalize everyone else just because he doesn't like them. He's also taking out lambdas, the bum. He said he didn't think there were many places where people needed them. He doesn't know anything about these features he's removing, and that's why he's removing them.
     
  17. Nov 6, 2006 #16
    Sorry for turning this into a *Which language is better* thread :uhh:

    C++ > * (sprints out of the thread)
     
  18. Nov 6, 2006 #17

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Python is really nothing at all like VBscript, Javascript, or PHP.

    I can't imagine anyone thinking that a Python program is harder to read than an equivalent program in, say, C++, my I suppose that's just my opinion. It is of course correct that anyone can write a painfully unreadable program in any language, including Python. Python has done wonders, in my opinion, to reduce paragraphs of code in languages like C++ down into very intuitive one-liners. If your task involves a lot of list and associative-array manipulation, I don't really think you could find a more readable language.

    Python has no more (or less) overhead than any other interpreted language. Python happily includes many, many libraries with implementations written in lower-level languages like C, meaning that the 20% of your code that consumes 80% of your CPU time will actually be running as fast as natively-compiled, optimized C. On the other hand, if pure speed is your goal, few languages other than C should be on your radar anyway.

    If the Python community doesn't like the changes Guido wants to make, then the community will almost certainly just fork into several subgroups with their own preferred implementation.

    - Warren
     
  19. Nov 6, 2006 #18

    verty

    User Avatar
    Homework Helper

    I think it should be mentioned that history and theory are probably the same thing. In fact, I would divide knowledge between history and theory. Technically, one could learn science without every hearing about phlogiston, or philosophy without ever hearing about socrates, for instance. Education in these areas does typically have a dash of history, but it is not essential to the theoretical understanding of the subject.

    So if you are truly interested in history, doing a theoretical course might not be the right thing. It seems to me that learning and understanding history can be aided by theoretical knowledge though, of such things as economics or perhaps even psychology/sociology, but also any theoretical training will give you good analytical skills which would be useful. I don't think one can divorce oneself from theory entirely, so if you do choose to study history, don't stop reading theoretical subjects that interest you.

    I think computer science is a very theoretical subject so you will not do much history, and I don't see that it would have much impact on learning history in the future. So I think this is a bigger choice than it first appears to be.

    Can you see yourself doing history for the rest of your life, or at least the majority? If so, history is the way to go. Don't think of it so much as what would be better. Everyone says that, then they end up doing something they don't like.
     
  20. Nov 6, 2006 #19

    0rthodontist

    User Avatar
    Science Advisor

    Indeed, from what I have used of it, those features are very nice. (though, Lisp and other functional languages have similar features) What I really object to in terms of readability is the "feature" where you don't have to declare variables before using them, and the lack of a type system.
    Any interpreted language is very slow. If you look at some benchmarks of Python vs. other languages, Python doesn't do that well. If Python has C libraries, I don't know why that doesn't speed it up so much, but apparently it doesn't--maybe it's the interface of those libraries with the Python interpreter.
    True, and I can't call myself "part of the Python community" having only learned the language a month ago. I don't know how many functional programmers are also involved Python users. But it is a rather poor set of justifications that he gives for his decisions.
     
  21. Nov 6, 2006 #20

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    I don't really know where you got your evidence that Python is slower than its peers; as far as I know, Python is used for many applications, like scientific computing, specifically because it is quite fast for those purposes.

    (Remember, if you're coding for speed, you want to spend as little time as possible in the interpreter, and as much time as possible in those hand-optimized internal routines -- the way you code a Python program can make a big difference in its speed).

    I'm no expert on speedy Python, though, so I wouldn't mind seeing the evidence myself.

    - Warren
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?