Should Undergrad Physics major learn C#?

Click For Summary
SUMMARY

Undergraduate Physics majors should prioritize learning C# before C++ due to its marketability and ease of learning. C# is recommended for its object-oriented structure, which fosters good programming habits. MATLAB is also essential for research in photonics, providing immediate utility. While C++ is powerful, especially for numerical algorithms, it is suggested to focus on one language at a time to avoid confusion.

PREREQUISITES
  • Understanding of object-oriented programming concepts
  • Familiarity with MATLAB for research applications
  • Basic knowledge of numerical algorithms
  • Awareness of programming languages like C# and C++
NEXT STEPS
  • Learn C# fundamentals and object-oriented programming principles
  • Explore MATLAB for data analysis and research applications
  • Investigate C++ for advanced numerical algorithms
  • Research the differences between C# and C++ in practical applications
USEFUL FOR

This discussion is beneficial for undergraduate Physics majors, researchers in photonics, and anyone interested in programming languages relevant to scientific computing.

Learn C#, C++ or both?

  • Learn C#

    Votes: 0 0.0%
  • Learn C++

    Votes: 4 50.0%
  • Learn C# and C++

    Votes: 4 50.0%

  • Total voters
    8
Kuhan
Messages
46
Reaction score
0
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 learned 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?
 
Technology news on Phys.org
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.
 
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.
 
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.
 
AlephZero said:
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++.

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.
 
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 anyone 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.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 4 ·
Replies
4
Views
746
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 21 ·
Replies
21
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K