r/learnprogramming • • 27d ago

In which project application is Csharp useful?

So, I have been using java till now and recently got switched to Csharp, and I wonder why we have to use Csharp instead of some other language. Like our project is about a payment app in which the crew customers or staff use it to keep record of all the transactions. So, why do we use Csharp is it because maybe they are more compatible with the situation there or is it for some other reason. And this question extends to other things as well in which way csharp is better than java.

5 Upvotes

33 comments sorted by

16

u/Objective-Ninja-5211 27d ago

The choice between C# and Java usually comes down to what the org is more integrated with and/or has more experience with, that's all. Companies deep into the Microsoft stack will almost always go C#, while those that aren't will usually go the Java route.

The languages are pretty similar, so apart from game development support (and windows native development) where C# is way more supported, you won't really see something one is better at than the other on a base level.

2

u/BrupieD 27d ago

Agree. I switched companies a few years ago. Each uses the other stack. The predominent stack drives subsequent software decisions so companies get deeper in one or the other.

2

u/Vizeroth1 27d ago

While I agree that C# is primarily used because you’re on a Microsoft stack (or more specifically something in your stack is running Windows or in Azure), Java as the alternative is a wild leap to me. In my work environment the alternative to C# is usually PHP, Python, Ruby, or maybe Go. In previous work C++ was the default alternative and sometimes preferred even on Windows, or Objective C on the Apple side.

Maybe that’s just my experience (or age), because the only place I’ve used Java is for Android.

10

u/zeekar 27d ago

C# was originally created as Microsoft's answer to Java. They're natural options to compare.

1

u/pak9rabid 26d ago

Java was also huge in the enterprise web application scene back in the day (J2EE).

5

u/plastikmissile 27d ago

The only reason you have to use C# is mainly because your project was started in C#, so it only makes sense to continue using it. Why was the project in C# in the first place? You'd have to ask whoever built it. Maybe he liked C# better than other languages. Maybe there was a specific library they wanted to use that was im C#. Maybe it was easier to find good C# developers than for other languages. It can be literally anything.

2

u/reddit_tom40 27d ago

This seems to be true of all big projects, whatever language they use. Switching stacks on a large project isn’t easy.

1

u/pak9rabid 26d ago

It was the premier language in the .Net ecosystem, along with VB.Net. An interesting fact about .Net is that libraries written in one of the languages (say, C#) could be imported and used from one of the others (say, VB.Net), as it was all compiled down to the same kind of bytecode amd could be used interchangeably.

9

u/Massive_Value8302 27d ago

It does everything Java does but better. But some orgs uses Java so they will continue to use java.

1

u/[deleted] 23d ago

Better? I would check that statement. First, Java has a huge ecosystem, and the JVM has several nice languages (Kotlin and Scala for instance). And the JVM C2 compiler is rather good. I don't know how C# compares, but Java is really not a bad stack. Regarding the language, there is this old grudge against type erasure for generics, but it's not really a problem. And since Java 8 there have been a lot of features. *My* main complain against Java isn't Java, it's Oracle.

1

u/Massive_Value8302 23d ago

"I would check that statement."
I have checked that multiple times.

Java loses every time nowadays.

"but Java is really not a bad stack"
It is not by any means, but ... C# is just better and more modern. Java can't keep up, the copy took over the og.

"*My* main complain against Java isn't Java, it's Oracle."
Both have bbeg behind them, but out of the two, I would say micro$oft is the safer bet.

1

u/[deleted] 23d ago

Well, I don't know enough of C# to tell (by far). Regarding Oracle vs Microsoft, meh. Neither. I prefer languages backed by a foundation, or even better, by a standardization body. Businesses need ultimately need to make money, they are not charities. Totally understandable, but for my programming tools I don't want to have such a constraint, and the risk of enshittification.

1

u/Massive_Value8302 23d ago

"I prefer languages backed by a foundation, or even better, by a standardization body."
Sure but we aint talking about those here, are we?

Lets stay on the topic.

1

u/[deleted] 23d ago

Right. It was just about MS vs Oracle. None if I can choose. But I'm genuinely interested by your argument, not sure how C# does on Linux, I might check if I have the occasion.

1

u/Massive_Value8302 23d ago edited 23d ago

"None if I can choose"

We aint talking about your choices. :) I agree with you tho.

"not sure how C# does on Linux"
Somewhat of a hassle to get set up as per MS, but .NET has been crossplatform for years. So it is fine, I would say. I wouldnt use it as the first choice on linux tho.

.NET itself is quite easy to use, but I have some experience on it.

I just checked few ranking sites and I appear to be wrong at least on popularity. Java beats C# in every one. This comes with lil caveat:
The one I trust the most, stack overflow, says that as a whole java is TINY bit more popular, and in the noob section (1-5 yoe) java is way more popular, but as the exp goes up, the popularity of C# rises. IDK what one should take from that tho.

I have used both and I just like c# better, but the difference is... semantics and bickering mostly. I find the C# little bit more friction free and modern.

1

u/[deleted] 23d ago

When I checked (and that's long ago), C# seemed to have some features of Delphi, which is of course not surprising. Well, let's add it to my todo list... It doesn't hurt to try. Thanks for the comments.

3

u/Aggressive_Ad_5454 27d ago

C# / dotnet has an almost magical combination of centralized architectural control, language extensibility, and tooling (Visual Studio with ReSharper).

We can get things done with it quickly and stably. And that’s what we want with line-of-business applications: to finish them and deploy them without reinventing flat tires.

2

u/Traditional-Story249 27d ago

I think the choice between C# and Java is less about which language is better and more about the project's ecosystem, existing infrastructure, scalability and long-term maintenance. For a payment application, reliability and security are critical, and both languages can handle these requirements. It would be interesting to understand what specific architectural or business requirements led to choosing C# over Java.

1

u/shyevsa 27d ago

as someone that only ever learn java in class, and only ever work a handful of time on java project outside android. your question are probably also mine just turn it around. why do you even chose java?

for your question however, it most likely not about which one is better, its more about who work on it.
and where the application is used. for example for desktop app that only ever used on windows there is almost no reason to use java. however for application that should be able to be used on multiple device with multiple architecture java indeed has a lot of compatibility layer.

for me the problem with java are performance, unless you really good with it its just painful to manage.

1

u/jakingo 27d ago

C# fits well with .NET-based systems, but Java can handle payment apps just as well.

1

u/iqisoverrated 27d ago

To what others have said: It can also be a question of support. Particularly with payment apps you need to be assured with *fast (*and longtime) support when something goes wrong in the language implementation itself.

1

u/cheezballs 27d ago

I genuinely am confused. You have been using Java but you talk about "Csharp" as if its some weird other worldy technology. How well do you know Java? C# and Java fill very similar roles and are very similar in syntax and look and feel. C# has more features and is a little more "Microsoft-leaning" depending on how your org has their contracts et up

1

u/Sufficient_Duck_8051 27d ago

Nobody other than oldschool corpos is using Java anymore 

1

u/ExtraTNT 26d ago

Done the same, first i wasn’t liking c#, got back to java and well, absolutely hate java now, have it side by side and well, java often just sucks… compared to haskell most languages suck, but c# at least let’s you work somewhat functional…

1

u/cdm014 26d ago

For any where the clients don't want to license Java just to run apps.

1

u/et_theextratestic1e 27d ago

Java has a beautiful architecture.  It is also very bloated; it seems every PhD was adding libraries to it for their theses.  Cross platform suitability is very low and it's slow. 

C# suffers none of these.  It does lack in suitable cross platform GUI libraries if you're not building a web app.  Java's are just ugly.

1

u/actualsen 27d ago

Avalonia and Maoi have closed the cross platform gap in recent years.

1

u/et_theextratestic1e 27d ago

Maui I haven't delivered into yet.  The other, had not heard of.  Thanks for mentioning it!

0

u/Dazzling_Music_2411 27d ago

Usually the reasons are political or financial. Control by Microsoft or Oracle or whatever.

The application domains of the languages are quite similar, as are their paradigms.

0

u/mredding 26d ago

I wonder why we have to use Csharp instead of some other language.

There is no best fit language for a given application. You need to consider technical and business factors.

Where does this software need to run? If it's on the browser, then it's going to have to be Javascript, because it's the only language natively supported by all browsers. If it has to be native, then you need a language that can integrate with the native environment. If you need cross platform native support, then that further constrains your language.

What performance do you need? What performance are you going to leverage? If you're rather compute heavy, then Fortran may be a choice language. If you are implementing business processes, then Fortran is among the worst.

What about the ecosystem and support? Python is hands down the most popular programming language on Earth. Where the HELL are you going to find a Forth developer but among a few vintage enthusiasts? If this is a business, what technologies are you invested in? Where are you going to find people familiar with those technologies? What technologies are easy to find expertise in?

C# and Java are practically the same thing. I've written production trading software in both. And now C# .Net Core is platform independent. So frankly, it's almost a coin toss between the two, unless this product is running on a Windows platform, or C# has a killer library, or if the company decision makers are already familiar with C#. Maybe they're not focused on cloud native so Spring Boot isn't all that attractive, or maybe they're REALLY into Microsoft so Azure is the only way to go...

Why not C++? I dunno, man...