Let's stop bashing C#

C#.NET.NET Core

Please contribute by voting. Thanks!
9

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.

Article created: Feb 2 at 08:11. Edited Feb 3 at 11:31.

7 Comments

4
Mark Entingh [4]  •  Feb 3 at 12:07  •   •  Reply

Visual Studio is free for developers & small businesses. MS SQL Server runs on all platforms now, is the #1 SQL database engine of 2016, and is also free & open source (and even includes the enterprise level features in the free version). You can run a commercial business on top of free, open source Microsoft technologies without having to spend a dime, as long as your business doesn't profit in the millions per year, at which point, is fairly cheap to invest in the software afterwards. AWS has a free-tier EC2 instance for Windows Server 2012 & also a free-tier RDS instance of MS SQL Server. C# can compile directly to C++ now using their CoreRT project. 60% of all code changes on the various .NET Standard & .NET Core github repos are made by the open source community outside of Microsoft.

https://connectevent.microsoft.com/

https://www.microsoft.com/en-us/sql-server/sql-server-vnext-including-Linux

http://siliconangle.com/blog/2017/01/06/microsofts-sql-server-named-best-database-software-2016/

http://mattwarren.org/2016/11/23/open-source-net-2-years-later/

https://github.com/dotnet/corert

1
Robert Bengtsson [104]  •  Feb 3 at 11:58  • 

Thanks for clearifying this, upvote to you! :-)

2
ridingThroughTheDesert [2]  •  Feb 7 at 19:51  •   •  Reply

Just wanted to thank you for the article. Good write. I had an extremely similar experience. I used Java and C++ for projects, and Python for fun, for years. I had always heard so many bad things about C# that I avoided it a lot, and was never forced to use it. Finally, I ended up with a job in web development for a large organisation, and sure enough... C#. I had to learn it quickly, and it was my primary language for a year in most things I did. I came to really appreciate it.

This article goes a long way toward explaining why people probably do have all of those misconceptions about it.

2
Matt Hamilton [6]  •  Feb 3 at 14:07  •   •  Reply

I consider Java and C# to be more or less on par, but the future looks pretty pale for Java and a bit brighter for C#. I hope Oracle will be more inclusive in the future.

2
Anders Martini [2]  •  Feb 3 at 13:38  • 

This is my feeling too, I have some experience of c# but work daily with Java..I feel Oracle is making the very same mistakes that Microsoft is currently correcting with their open source drive. I'm not sure I'd say their on par just yet though, at least not if you compare only the open parts of c# with Java. But it's getting there, and by the looks of things will continue.

Some of the newer features of c#are really neat! (Async/await)

1
Maxence Delannoy [1]  •  Feb 3 at 13:11  •   •  Reply

JetBrains Rider will be not free when it will be released. Source: https://blog.jetbrains.com/dotnet/2016/01/13/project-rider-a-csharp-ide/

0
hatt [0]  •  Feb 3 at 12:25  •   •  Reply

I want to code in c# and SpecFlow, NUnit under the Linux. Is it possible today?

Your comment

You need to sign up / log in to comment this article

Author

Created by Robert Bengtsson [104] Feb 2 at 08:11

Share article

Do you know about

HTML?

Write an article