.Net and C# are drivers. Plus, people just have Windows computers.
Amateurs can do as they like, but professionals need to follow the money, and sometimes, Windows is where the money is.
Edit:
Windows has a few strong points, I particularly like the Visual Studio debugger and there is no equivalent on Linux (my platform of choice) that I am aware of. But really, since you specially mentioned professionals, the answer is simple: money.
If you want to sell a Windows Desktop application to your customers, you probably want to write it on Windows.
- to build C++/C# executables that are deployed to Windows computers. Examples are the millions of corporate desktops that already use Microsoft Office suite and home pcs with Windows for running AAA games.
- to build ASP.NET web apps because the corporation chose the Microsoft stack of WindowsServer+SQLServer+C# instead of Linux+MySQL+PHP.
Why do companies continue to use Windows instead of Linux? Often because they have lots of other desktop software that only runs on Windows. E.g. CAD, analytics, etc.
If the target audience is already on Windows and the implementation language is C++/C# instead of Javascript/Electron, the easiest path for the developer is to also use Microsoft Visual Studio on Windows.
I wish evey Lang had as good IDE as vs is
Xcode used to be good as well, but now it seems slow and crashes all the time. It’s a terrible ambassador for the engineering culture at Apple.
What exactly with VS is so great? Maybe I didn't use that feature..
1. Most consumers using Windows. That might not be the case in USA, but definitely the case in the most of the world.
2. To develop for a platform, primary choice would be platform creator recommendation. In this case it's obviously .NET from Microsoft Visual Studio. It contains extensive UI libraries and components.
There are alternatives, of course, you can use Qt or Electron or just web app. But you would need a good reason to move from the primary path. For many projects there's no good reason, so you naturally using .NET to write GUI applications for Windows.
3. To develop .NET GUI applications, you need Windows. Any other option is inferior.
That was the case 10-20 years ago. So plenty of projects were created and plenty of developers were taught .NET and Windows.
Today web apps are more popular. But .NET provides excellent support to create web apps, so there's no reason to switch from Windows.
That's why many professional developers use C# even today.
Of course different people might move different paths. But I think for majority that's the way. .NET GUI frameworks and may be Sharepoint created huge number of Windows developers.
Though the argument makes for a convenient straw-man since it used to be true until 2016.
Security by obscurity in all its glory but they used to do the same with a very easily escapable panel replacing the default windows shell in Win95 and Win98. :)
Fast enough for most applications. Memory safe enough. Easy enough to learn. Good enough type system. And it helps that it’s integrated into unity and windows. Also the ecosystem, compiler and IDE support is exceptional.
It’s not perfect. It’s slower than native code. It has a worse type system than rust, Swift and typescript. (Burn the nulls!) And C# needs a runtime - which makes it annoying to deploy on Mac & Linux.
I’d put it as an A tier language.
Nulls have stopped being an issue in practical terms since you specify nullability explicitly e.g. string?/string.
C# does not need runtime installed on the host. You can produce JIT or AOT executables which include one. It also needs runtime on Windows just as much (if you don’t include it or host doesn’t have it installed). Only .NET Framework was preinstalled but no one (sane that is) chooses this legacy target for new code.
I did c, cpp and c# for money and thats my experience.
C# has lowest amount of WTFs per loc
In short, nowadays it's a pretty strong contender and can fill in similar niches to Java (decent type system, good runtime, good tools, nowadays available on most platforms), with downsides that to me don't seem like dealbreakers (not as big of an ecosystem, which leads to breakages along the way when tools and libraries aren't as well maintained).
I've also used Node, Python, Ruby, PHP, a bit of Go and some others on the back end, I'd say that it's a bit slower to develop in than many of those but the performance and maintainability of the code (especially the refactoring you can do in the IDEs) feels worth it. Maybe for not quick MVPs, but probably for multi-year projects.
Sure, C# looks great when compared with C or C++, but that's a very low bar to pass. Compare it with Java, and it's on par at best. Compare it with Rust, and C# might as well be C.
(vim and a bash shell are all you need)
I’ve been programming for 30 years and I still feel very mixed about that. For some projects, I figure who cares if it took us 30k lines to solve the problem. It’s just that complex, and more code = more optimised data structures and faster runtimes. On other days I’m reminded of how productive I can be with tiny programs or libraries that just solve their own niche exceptionally well. The best small libraries basically never need to be modified or updated. They just work and keep working forever.
I don’t think this conflict can ever be solved once and for all. I’m sad that Chrome and Linux are around 20-30M lines of code. Would they be better or worse programs if they were smaller? It’s so hard to know.
One of the first lessons I learned same 30 years ago in CS class was that invariably you'll find at least 3 bugs/kloc, regardless of where those 1000 lines of code came from. Highly critical battle tested code tended to have less, but even code where those 3 bugs had been fixed, ultimately given enough time would turn out to have yet another 3 bugs (on average). That's scary!
My professor suggested 2 ways to mitigate:
1. create robust systems that can handle malfunctions
2. never write a single line of code that doesn't need to be written
Ps. Don't think it's fair to attribute Linux's vast code base to IDEs.
Not sure if I agree, can you elaborate? Seems a more modest claim "more code allows for more optimized ds and faster runtimes" would be more accurate(?)
At least, in the Pentium era it used to be that instructing compiler to optimize for size often resulted in faster code than optimizing for speed. That was of course the result of relatively small (text segment) caches and the often underestimated effects of temporal and spacial locality.
Yeah; I’m assuming the code in question is produced at a similar skill level. Hence mentioning Linux and Chrome.
But you’re right; large projects are often large because they’re written poorly. Personally I think there’s a special place in hell for people who bloat programs unnecessarily. Making if statements into class hierarchies. Adding generic interfaces to things that don’t need them. Factories and factory factories. This stuff reduces your team’s productivity with no corresponding benefit. I hate working with people who argue for this stuff.
Do you compile with an IDE?
There used to be tools that built compiler, runtime, debugger and editor all into a single monolithic hammer, like 4D in late '90s (FourthDimension). There is excel, of course. Nice for prototyping, but very clunky if you want for build and maintain professional software packages that are easy to test and to deploy.
If visual studio were the only way to use Visual C++, we'd long ago abandoned cross platform development.
- Windows has a 72-75% market share of desktop OSs.
- About 95% of non-console video games are developed either for or on Windows. And video games are the most lucrative entertainment market—more than music, film, television, and adult entertainment together.
- A large majority of internal sysadmin is run with Windows Server 2022, including things like Active Directory, Exchange, SMB, etc.
- About a fifth to a quarter of public web servers are also running Windows Server.
These are the financial factors.
- Windows is a decent development environment—sue me, UNIX greybeards.
- Visual Studio 2022 blows everything that the FOSS world has come up with out of the water. GDB, perf, LLDB, dtrace, I've used them all. They all suck compared to what VS offers. After some point, you want to stop screwing with 'my OS is an IDE', and just click through your source code setting red circles, press the green play button, and then smash F5 jumping through code. And it works.
- During debug, I get flame graphs, memory and CPU profiling with live graphs, stack traces, exception traces, conditional breakpoints, thread tree views, local, global, and 'auto' variable values, highlights when variable values change, and even GPU debugging.
- For a 'closed-source' OS, debugging and profiling on Windows is still better than on Linux[1].
- Windows comes with a fantastic GC runtime—.NET—and an equally powerful shell (heh, maybe that's why they called it PowerShell) that can directly call methods and classes in said runtime. I'd like to see the UNIX shell with an equivalent.
- Windows doesn't have fork(), and all the baggage that comes with it. It is possible to back-target Windows XP and even Windows 2000 from a computer running Windows 11 and VS 2022. I'd like to see what Linux can do barring 'let's spin up an old CentOS Docker'.
These are the development factors.
As a user OS, it's getting enshittified, I fully concur. I despise the encroachment of ads and 'Copilot' everywhere. But as an OS, I'll daresay it is every bit as productive as Linux is, if not more so.
[1]: https://www.reddit.com/r/rust/comments/hrqr36/cpu_profiling_...
Developer !== UNIX.
Your industry peers aren’t your comrades in this weird 2000s holy war.