r/learnprogramming • • 5h ago

Topic C# or Java?

If you had to choose one class between the two, which would you select and why? I tried to Google the purpose of them; the immediate answers from Google felt very vague and like both of the languages are common. Is one course better for web development as opposed to apps or something? Looking at the courses I'm taking, down the line I will select one of the two. The only thing I know so far is C++, so I'm quite new.

Also, side question: why are there so many languages? The only logical thing I can imagine is there were problems that couldn't be solved with say for example C++ so someone created something new. But why not just build on the original language? Why did they need to reinvent the wheel? Or is it as simple as that: someone wanted to create their own thing?

0 Upvotes

30 comments sorted by

View all comments

3

u/a3th3rus 4h ago

It depends on your programming skills and what you want to build.

For me, as a language, Java has less features than C#, so it's easier to learn, but if you are a polyglot and have a decent amount of experiences, then you may find that Java sometimes lacks one feature or two you want. Java also has a bigger market than C#, unless you are going to develop video games.

Why are there so many languages? Because all languages are somewhat opinionated, and they are trying to solve different common problems but are willing to sacrifice performances in solving other common problems, like C/C++ focusing on raw speed, Java initially aiming for cross-platform execution, Ruby aiming for developers' happiness (though it fails to deliver that for large projects), and Rust for memory safety while keeping raw speed, Erlang for self healing and horizontal scaling, so on and so forth. Theoretically, C/C++ can solve all problems that can be solved with programming, but to solve some problems you need to write hundreds of thousands of lines of code in C/C++ but you don't even bother to think about it in Erlang.

2

u/Mughi1138 4h ago

Oh, and you forgot Go (aka GoLang), which was created so that Google could hand it to brand new college grads and it would keep them from shooting themselves in the foot or in having to need too much experience to be productive. Also so that it could be compiled to native instructions to execute on farms of many different architectures but with each being more of a monolithic block of target requirements on fairly new hardware.