Why C# is not a good choice for web development?

C# is the main programming language in Iran. I’ve worked with several teams, various projects and developers with different development skills. Earlier I’ve worked with PHP.

There weren’t any motivations to migrate from PHP to C# but the company’s infrastructure. Most of web development companies in Iran work with C# and Microsoft technologies, and here is the reason, because they don’t want to learn more. Companies prefer to stay at the same level and do not pay for improving their developers skills!

If you ask them: “Why you are using C# for web development?” I bet they won’t give you acceptable answer.

I haven’t used C# for my own projects, and I won’t at all. It’s preferable to me to use NodeJS or Python, not only because of their popularity, but because they are scripting languages.

After spending ages with C#-based web apps I want to tell something horrible about this language and why it’s not an appropriate choice for web development.

What I explain here is the issue that I faced with, several times. Before explaining the problem let me tell you something about C# compiler and how it works.

Suppose you have a Service Layer project, like following:

All of above files are located in a same project (.csproj file). You can use this project as a dependency for other projects, for instance, the NewsService class to fetch news from database. If you compile it, compiler gives a .dll file. This file is used as a dependency file for other projects, meaning, in order to change only one method in NewsService class, you should replace whole dll file, not only one file.

And yes, I know, it’s not the problem of C#.

Ok, here is the difficulty. We have a C#-based web app in our company, we use MVC for it’s presentation. There are a lot of instances of this app that deployed in different machines. Suddenly, we realized that there is a performance issue in our app. One of our customers reported it to us. The remedy was change the logic of a method in the Service Layer.

The change is easy, change the method, build it and replace new dll with old one. But replacing the new dll file will change other class and methods signature and logic, too.

I realized that the current version of deployed application is a little bit older than last stable version. So, if I decided to replace the fixed Service Layer with the current one, application will break because of the change of other methods.

In this situation you can ask me why you don’t have any versioning system, this kind of issues can be solved using Semver or something. My answer is: we were wrong at the first days of structuring our team, so we missed this part.

But what if we used Python instead of C#? The key was as easy as fixing that method and upload only one file, without touching other files. Additionally, changing a C#-based web app version is a nightmare for me. Conflicts between dll files, their versions, etc.

Despite all great features and nice parts of C#, in my opinion above reasons make it a bad choice for web development.

At the end of nagging I want to show you something:


Is it cool to use a design pattern name as a name for framework?


Read this next

Simplified MapReduce

I believe one of the best solutions to solve a programming problem is to find a paper or article and read it as a clue. Well, of course Wikipedia, BMI and other sources are really helpful but somehow reading them is a nightmare for me,... Continue →