What are the scenarios in which C# has an advantage over other languages?

Asked

Viewed 1,303 times

5

  • When you think about microsoft, I believe this is the best "scenario".

  • @Wictorchaves then C# only has more advantage when an application for Windows should be developed? When you can choose which operating system the service will run in, other languages will be better?

  • This question is very wide, because c# is used for many things, from web to desktop applications, microsoft has a project to run their applications on linux for example, but nothing better than running on their native operating system right? I particularly if I had a linux server would prefer to use php since it is in the market more time, and the same would be if I had a windows server I would prefer to use c#, but since it is something very broad each case is a case, but briefly believe that if you think about microsoft the best is c#.

  • @Wictorchaves thanks, I edited the question focusing on web development

1 answer

10


Wictor has already commented on something important, but this is also a common mistake.

Rare languages work as well on a Microsoft technology stack as C#. Not by it, but by the infrastructure around it. And let’s face it that on desktop we practically only look at Windows.

The error is that C# is not suitable for all platforms and is committed to anything that comes up that is relevant. I gave a talk about it.

Where it will be used is not criterion.

Let’s understand that C# is a language like Nterprise, then it comes with a very strong infra. She is of general purpose, so you can do almost everything with her, you better ask where she does not fit.

I will leave aside taste and experience. This is important. Doing what you like helps a lot. Knowing how to use well makes everything more productive and usually gives better quality.

Performance

C# performance is excellent and can beat C or C++ into simpler codes. Of course, maximum performance with a lot of effort will be achieved with C or C++, or Assembly in some cases. But it really takes a lot of work. From my other talk:

Batalha de performance C# vs C++

C# today gives much more importance to performance than 10, 15 years ago.

If by performance you’re talking about performing real team, which is rare to need, it’s possible, but C# takes a lot of effort because of Garbage Collector, and in some cases hard real time can’t.

.NET Native will help more in overall performance. But it may get worse in some specific points. Note that this is a specific implementation of *Runtime, nothing to do with the language itself. It will not have continuity, but part of its benefits is now on . NET 5.

"Every day" has more novelties to improve performance, but has always been a pragmatic language on this, compared to the idealism of some languages, as Java has.

Flexibility

C# is flexible and versatile, difficult to answer something specific about this, in general meets almost every need. It’s powerful, it can solve reasonably well in almost every situation, regardless of being just an academic way of seeing (Turing complete), I mean, in practice it does well.

Gives, but is not suitable to make an operating system (COSMOS, Sharpos, Singularity, Phlegms, MEUSE and Midori). Many restrictions to make a good driver. Does not compare with C++ for this, what much of the question is already answered there.

It’s not a language of script, but can be used (in C# 9 this has improved a lot). You can use embedded within some databases, today may in web browsers to do frontend (nor will I mention backend now, and has one of the best libraries for this), runs all platforms mainstream, including mobile, on all important servers, including cloud (AWS, Google), with own optimizations for this (Azure), and is getting better at Iot.

The rest is library, which has much for her.

Organizing

I’m not sure what that means and it can only be based on opinion. I consider it well organized by various criteria. It has good architecture, syntax, semantics, general ecosystem, including excellent productivity and quality tools.

Ease

It’s a relatively easy language for the power it has, much more than C++, and compared to C, it depends. C is easier to learn and harder to use, mainly by having fewer abstractions, fewer things ready, and by not having automatic memory management.

It is a very well defined language and only not very easy because it involves many concepts.

Languages of script are easier. But they are less robust and less scalable. C# is made for large, lasting projects that are highly relevant. Tend to be more productive in the beginning.

Web backend (the question changed midway)

I told you it also runs on frontend (in a brief lecture of mine of TDC 2018), and I go with it firmly, even if it is experimental. For my taste I find more business, at least for application, although I am not a fan of web applications, but have reason to use. For websites it’s different, they can’t be complex, so I don’t know, it depends. I think Blazor will be better than Angular, React, all that stuff.

The language itself changes little or nothing to web development on backend. Makes more difference to the task itself.

C# is more scalable, like I said, but that’s not a strong advantage. Less scalable languages can be used in large projects with the right culture. And I’m talking about scaling the project, I’m not talking about scale, this can be done with any language.

Of course, more efficient languages can decrease the need for runscale. C# may be dozens of times faster than Ruby, for example, and may need a single server instead of several parrudos servers. But your decision on other points will make more difference. Sqlite can scale better than an SQL Server in some scenarios, as long as one knows what they’re doing.

It has huge websites made in each of the languages mainstream, all beauty. This one is done in C#, is one of the 30/50 most accessed sites in the world, and runs on 11 servers, but could run in only 1 with risk of bottlenecks at some times. Okay? You don’t need to use languages that are potentially faster with an effort to get good results, and those languages that can be faster run a serious safety risk in an environment where this is absurdly important.

Have sites made in languages script that climb in performance well, with the right architecture, but it costs very expensive. One of the reasons I refuse to contribute to Wikipedia is because it is ecologically and economically incorrect. Some sites succumbed and switched languages to one that scale better, Twitter is an example and Scala is the tip :)

One of the advantages of C# is its ecosystem, it’s not the best, but it tries to be. It doesn’t have trocentos frameworks, but there is one who has learned from his own mistakes and those of others. And it has the advantage of not being too tied to the legacy. Including the .NET Core has been optimized for this. There’s a lot of good stuff. But it’s not the language. Even all this can be used with other languages that run on top of the CLR.

It has details, but nothing very important that makes C# less suitable than other languages. But I defend other languages when the project is small, it won’t meet that much demand, it won’t last long.

Extra

Particularly if more market time is critical to choosing the language, you should use Fortran, or Lisp, or COBOL. It is common that what is longer is worse because it could not learn from the mistakes and she has a very heavy bad legacy. I would use PHP for some things on the web, but in general it’s one of the most wrong languages ever created, and its evolution is usually on top of new mistakes, that’s pretty reckless. And I can’t imagine why PHP would be better on Linux and not on Windows, and why C# would be good on Windows and not Linux.

I have criticisms of C#, but I have more of the other languages. What I like most about C# and its ecosystem is that it’s evolving very well, they’re doing what they need, not at the speed I wanted, not everything I want, and it has reasons to be like this, but the others are behind. I’ve also enjoyed the evolution of C++, but her legacy is very heavy. A middle ground language between C++ without the legacy and C# would be sensational, almost unanimous and Microsoft was developing it, but it was over (see Midori above).

I like some more recent language initiatives, an ideal new language would look for D, Rust, Go, Kotlin, Swift, Nim, Jai, F#, and others much less known.

  • When you talk about C# on the frontend, you mean a desktop application, right? The code to develop a web application is the same for a desktop application (the bank access and flow control part), right? In short, isn’t C# just a great choice for simple projects? Have some web backend language that can match C# (as well as C and C++ for desktop)?

  • No, I spoke web. For desktop is different from web, in general, unless part that does not involve user interaction. C# is good for simple projects, but it may have some language that is better. But there’s one detail I didn’t mention, in simple projects it doesn’t matter :D. Equating is too broad a concept :)

  • I don’t know the language yet but this answer gave me the final incentive I needed to start in C#, I’ll start with the links on the wiki ta tag, thanks for the help. But if matching is a very big concept, then there is some language that can beat a well done C# backend in some scenario that is not a simple project?

  • It’s hard to say why hitting is an even broader concept :D

  • " And I can’t imagine why PHP would be better on Linux and not on Windows, and why C# would be good on Windows and not Linux", Just a small observation, I took into account the searches, usually when thinking of php, if think of linux servers, and when thinking of c#, comes straight to mind microsoft, I believe it is important the range of content in relation to the chosen language.

  • But is that a reason to decide what’s best? Even save small details, it doesn’t make the slightest difference where the language is running, usually well below 1% of everything you do, so it shouldn’t be something to consider. In the past there were even certain difficulties. Even one of the reasons for not doing searches to make these decisions is because it has a lot of outdated information, a lot of wrong information, a lot of misrepresentation, a lot of incomplete information, and fake news run easier than true. I used + PHP on Windows (which was bad) of q on Linux and hj use C# more on Linux

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.