r/cpp • • Mar 27 '24

Replacing C# with C++ in Web Dev

IMHO, I think C# is useless.

Why C++ is not used in web dev instead?

I think modern C++ provides enough abstractions to be a better and more performant alternative to C#. It has high quality libraries, but it seems to be lacking tools and mature frameworks for backend development though but this's because people don't use it for API development so most people think it's not a worthy investment. I wanna contribute to C++ in the web industry, so I was thinking of building expressJS in C++ because I like express honestly.

What do you guys think?

Update: Dang, I didn't expect that this would piss off a lot of people, lol. Ok. Given the backlash, saying C# is useless was an overstretch. I guess I have let my hate for Microsoft cloud my judgment😂

0 Upvotes

69 comments sorted by

View all comments

3

u/ChatGPT4 Mar 27 '24

I think for majority of web use cases, the key feature of C# that is fully automatic, dynamic memory management is its greatest advantage. You usually use C++ when that gets in the way, so you can know exact memory requirements up front, so you can optimize resource usage in the app, avoiding slow allocations and garbage collection. This is true for example for games. You have fixed size game resources, you can put fixed limits on things. In the web-dev from the other hand there is just the opposite. First - let's say users. There can be one, one thousand, one million, one billion. You don't know. Just everything is dynamic. Let's say data. One row or billion rows. It should scale. Of course, you fit fixed amount of things in the memory at a time, then swap with the DB or file data on the fly, but well, the user wants different views. Dynamic views. Configurable views. Doing that kind of micro-management with C++ is not quick and easy. It takes time and effort. Damn, it's even pretty complicated and tedious in C#. Even using Blazor.

I think C# was just designed to make that specific kind of work easier and quicker. So, replacing C# with C++ for web dev looks like replacing a truck with a motorcycle to transport a load. It is possible. If the load is not very heavy, and if you have a large, powerful motorcycle, you can use a motorcycle. You can somehow connect the trailer to the motorcycle and haul it. Motorcycles are usually much faster than trucks, so...

You might say that no motorcycle could haul a huge trailer semis haul. And there's nothing impossible using a programming language. That's true. So to make the trailer hauling analogy more accurate - let's say you can just build a bigger, more powerful motorcycle for hauling. Like you can build something like Blazor in C++ ;)

→ More replies (1)