Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Should Undergrad Physics major learn C#?

  1. Learn C#

    0 vote(s)
  2. Learn C++

    4 vote(s)
  3. Learn C# and C++

    4 vote(s)
  1. Dec 15, 2012 #1
    I'm an undergraduate Physics major. I'm interested in doing research, right now I'm aiming to do undergraduate research in photonics (I'm just a freshman).

    After a conversation, I learnt that I should learn C++, mathlab, AUTOcad and labview to use in my research.

    My question is:
    Does it make sense to
    learn C#, C++ or both?
  2. jcsd
  3. Dec 15, 2012 #2
    Learn both. Pick up C# first. It's more marketable these days, easier to get into, and will help you learn good habits before you pick up C++ (and invariably, C). Personally I recommend pascal (and object pascal / delphi) as the best there is for teaching good programming habits, but through a comedy of marketing errors, that language is almost dead today.
  4. Dec 15, 2012 #3


    User Avatar
    Homework Helper

    Depending on the student price, get matlab first, since you'll be able to use it very quickly if you're already doing research. As for C# versus C++, I think it depends more on the class curiculum (is there a intro class oriented towards non-computer science majors?) than the language.
  5. Dec 15, 2012 #4


    User Avatar
    Science Advisor
    Homework Helper

    Unless you want to use Microsoft's ".net" framework to make your software communicate with other MS products and network services, I can't think of any reason why C# is "better" than C++.

    C# has all the problems of C++ for writing numerical algorithms - except there are some fairly good workrounds in C++ which don't exist in C#.

    Trying to learn C++ and C# at the same time would also be a bad idea IMO, because for a beginner they are similar enough to be confusingly different, if you see what I mean.
  6. Dec 15, 2012 #5
    I gave a few reasons.
    1. More marketable.
    2. Easier to learn (entirely OO, no chances of picking up procedural habits from examples)
    3. Learn good habits (again, all OO. Strongly typed. Etc.)

    Many of the same sorts of things that make Java appealing as a first language.
  7. Dec 17, 2012 #6


    User Avatar
    Gold Member

    My two cents.

    I would focus on becoming proficient in one language. That will give you a good foundation if you need to learn another language. I recommend something object oriented so that you get both the structural exposure as well as the object oriented concepts.

    I studied C++ and when I arrived at graduate school we used FORTRAN and C. In my experience the language predominately used by the group is usually what the adviser is most comfortable with or whatever is the currently working program language. My group worked with C. The other two groups on my floor used C++ and FORTRAN. No one wants to redo code as long as it works.

    My own personnel experience is often you do not master any one language as a researcher. You just learn enough to make it work. The focus is on getting results. A good grasp of programming concepts will enable you to get it done more efficiently regardless of the language used.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook