So I've recently discovered that C# isn't so well-regarded in some communities. I have a background working with C, C++ and Java but am currently mainly working with C# - and really enjoying it so these opinions came as a surprise to me. I suspect that the bashing of C# is due to a lot of misconceptions, but I wanted to research the topic a bit and try to understand both sides. Anyway, here are a few of the most common reasons people seem to criticize C# and my take on them:
"C# is proprietary"
The most common criticism is that C# is owned and developed by Microsoft and is thus proprietary, closed and expensive. It's often not meaningful to talk about C# without mention its environment, so I'll also address the compiler, the runtime and the libraries.
The language
The C# syntax is developed by Microsoft and later released as standards under the organisations ECMA and ISO. You are free to use these standards with some protection from patent claims through RAND and other agreements from Microsoft's side. This means that you should be able to create your own C# compiler.
The language itself is evolving in a steady pace, and is by most people (I think) considered pretty good. However as Microsoft is the sole author of C#, the community doesn't have much to say about the direction of the language (and the environment). You can discuss and suggest improvements on the language mailing list, but it's up to Microsoft to select what features they'd like to include in each version. On the other hand, I think that this process is pretty comparable to languages like C, C++ and Java.
The compiler
C# has a number of compilers such as:
- The legacy .NET compiler - runs on Microsoft platforms
- The new .NET Roslyn compiler - written as an open-sourced self-hosted C# program under the Apache license and runs on all common platforms
- The Mono C# complier - open source and runs on all common platforms
The runtime
The C# code compiles to a binary language called Common Intermediate Language CIL that runs on a virtual machine runtime and there exists a few compatible runtimes such as:
The libraries
The legacy .NET libraries (much like the legacy compiler and runtime) are only available on Microsoft's own platforms. The source code for the libraries is in many cases available through Microsoft Reference Source program. The .NET Standard and .NET Core libraries are however totally free, open source and multi-platform. They are unfortunately a bit limited in functionality compared to the legacy .NET libraries but expect this to change over time.
Summary
So to summarize: The current strategy of Microsoft is that C# and its environment will be free, open source and multi-platform, e.g. through .NET Core. However we'll have to wait a little bit for .NET Core to be a complete and mature ecosystem. These are the options that you have as of today:
"C# is not [insert hipster language]"
Some people compare C# with languages such as JavaScript, Python, Ruby and Dart the most common reasons for criticism seem to be:
- C# has semicolons
- C# uses to many curly brackets
- C# is strongly typed
- C# is statically typed
I actually consider all of the above advantages - it gives the language probability, stability, readability and maintainability. I understand why it might seem easier to develop with say a loosely typed language, but for me the advantages of a statically typed language outweigh potential downsides.
Having that said, I understand that languages like JavaScript might be needed in some cases, but I'd prefer to write my SPA in C# if that was an option (which it soon might be).
"C# is not [insert mature language]"
Another common reason for criticism is that C# doesn't work exactly like C, C++, Java or other mature languages in areas such as:
- OOP
- Generics
- Types
- Speed
And so on...
I would say that the majority of the claims boil down to the following: You should select the right tool for the task. If you are to write embedded software you should consider C or C++ - but if you are to write a complicated business system C# or Java might be the better choice. Specific features of each language (e.g. virtual by default in Java vs explicit virtual in C#) may have its advantages and disadvantages, but all these languages have a good and solid design as far as I'm concern and that's more important than how specific features work.
"The Microsoft ecosystem is expensive"
I mean, yes, Windows Server, SQL Server, Microsoft Azure and Visual Studio can be pretty darn expensive.
However, you are no longer forced to their ecosystem; you can run .NET Core or Mono on Linux, using PostgreSQL as DBMS and JetBrains Rider IDE for free.
Summary
For me, C# is a beautiful and modern language that is in active development and has a vibrant ecosystem. It has a proprietary history but it's now free, open source and multi-platform - even if .NET Core needs a little more time to mature. C# might not the best tool for all jobs, but I would say that it's a pretty great choice for some.