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:

  • UserService.cs
  • GroupService.cs
  • NewsService.cs

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:

ASP.NET MVC

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

Source: New feed

One response to “Why C# is not a good choice for web development?”

  1. Yas says:

    This funny article should be like : how come I became a programmer and why I should not be?

    Versioning is to for your good and if you are lazy to implement it do not consider as a bad feature from “Static” languages web frameworks like ASP or spring mvc. Replacing one .py file is similar to replacing BusinessServices.dll, all must be avoided and use a proper way of deployment through a strict and pre-defined procedure.

    “All of above files are located in a same project (.csproj file)” Have you ever heard about something called modules or design patterns? http://www.wrox.com/WileyCDA/WroxTitle/Professional-ASP-NET-Design-Patterns.productCd-0470292784.html

    Give a proper and logical reasons when you talk like “programmer”

Leave a Reply

Your email address will not be published. Required fields are marked *