C# Is Dying

Andrew Zuo on 2021-08-30

And Microsoft Is Killing It

Photo by Ruben Ortega on Unsplash

I love C#. My first real programming project after University was a game written in Unity. And I immediately fell in love with the language. It just felt so fresh. It was like Java… if Oracle had actually cared about it. This was back in the Java 7 days. I hear they moved to a faster release cycle since then so things might have changed.

And I still love the language. I mean it may not be the fanciest but it can still do anything. Like multithreading. You think multithreading is hard? Well, go to Dart-land and start playing around with Isolates. You do not realize how good you have it.

But in the last few years I have become very worried about the fate of C#. I actually shared my thoughts in a comment here and because that comment got so much attention I thought I’d elaborate here.

The Crux Of The Argument

So in that comment I said

C# is dying and Microsoft is killing it because they keep adding random stuff no one asked for. It’s death by feature creep.

Pretty clear. Pretty self-explanatory. Absolutely no need for an article. But I’m going to write one anyways.

Short Of Bombing, I Know Of No Way To Destroy A Programming Language That Was More Effective Than Feature Creep

The above quote was paraphrased from a Freakonomics episode. This one:

The original quote was “Short of bombing, I know of no way to destroy a city that was more effective than rent control”. I didn’t change bombing because I didn’t know what the equivalent was for a programming language. But bombing would not work. I mean you could bomb the company’s HQ, but it wouldn’t kill the language, only stop development for it. I hope I don’t get demonetized.

So the problem with feature creep is that it makes a programming language more difficult to learn and master. If you want to see an example of this see the alleged interview with the inventor of C++, Bjarne Stroustrup. Here’s the entire interview if you’ve never seen it. It’s fake, but it’s pretty funny.

On the 1st of January, 1998, Bjarne Stroustrup gave an interview to the IEEE’s ‘Computer’ magazine. Naturally, the editors thought he would be giving a retrospective view of seven years of object-oriented design, using the language he created.

By the end of the interview, the interviewer got more than he had bargained for and, subsequently, the editor decided to suppress its contents, ‘for the good of the industry’ but, as with many of these things, there was a leak.

Here is a complete transcript of what was was said, unedited, and unrehearsed, so it isn’t as neat as planned interviews. Interviewer: Well, it’s been a few years since you changed the world of software design, how does it feel, looking back?

Stroustrup: Actually, I was thinking about those days, just before you arrived. Do you remember? Everyone was writing ‘C’ and, the trouble was, they were pretty damn good at it.. Universities got pretty good at teaching it, too. They were turning out competent — I stress the word ‘competent’ — graduates at a phenomenal rate. That’s what caused the problem.

Interviewer: Problem?

Stroustrup: Yes, problem. Remember when everyone wrote COBOL?

Interviewer: Of course. I did, too.

Stroustrup: Well, in the beginning, these guys were like demi-gods. Their salaries were high, and they were treated like royalty.

Interviewer: Those were the days, eh?

Stroustrup: Right. So what happened? IBM got sick of it, and invested millions in training programmers, till they were a dime a dozen.

Interviewer: That’s why I got out. Salaries dropped within a year, to the point where being a journalist actually paid better.

Stroustrup: Exactly. Well, the same happened with ‘C’ programmers.

Interviewer: I see, but what’s the point?

Stroustrup: Well, one day, when I was sitting in my office, I thought of this little scheme, which would redress the balance a little. I thought ‘I wonder what would happen, if there were a language so complicated, so difficult to learn, that nobody would ever be able to swamp the market with programmers? Actually, I got some of the ideas from X10, you know, X windows. That was such a bitch of a graphics system, that it only just ran on those Sun 3/60 things.. They had all the ingredients for what I wanted. A really ridiculously complex syntax, obscure functions, and pseudo-OO structure. Even now, nobody writes raw X-windows code. Motif is the only way to go if you want to retain your sanity.

Interviewer: You’re kidding?

Stroustrup: Not a bit of it. In fact, there was another problem.. Unix was written in ‘C’, which meant that any ‘C’ programmer could very easily become a systems programmer. Remember what a mainframe systems programmer used to earn?

Interviewer: You bet I do, that’s what I used to do.

Stroustrup: OK, so this new language had to divorce itself from Unix, by hiding all the system calls that bound the two together so nicely. This would enable guys who only knew about DOS to earn a decent living too.

Interviewer: I don’t believe you said that …

Stroustrup: Well, it’s been long enough, now, and I believe most people have figured out for themselves that C++ is a waste of time but, I must say, it’s taken them a lot longer than I thought it would.

Interviewer: So how exactly did you do it?

Stroustrup: It was only supposed to be a joke, I never thought people would take the book seriously. Anyone with half a brain can see that object-oriented programming is counter-intuitive, illogical and inefficient.

Interviewer: What?

Stroustrup: And as for ‘re-useable code’ — when did you ever hear of a company re-using its code?

Interviewer: Well, never, actually, but …

Stroustrup: There you are then. Mind you, a few tried, in the early days. There was this Oregon company — Mentor Graphics, I think they were called — really caught a cold trying to rewrite everything in C++ in about ’90 or ’91. I felt sorry for them really, but I thought people would learn from their mistakes..

Interviewer: Obviously, they didn’t?

Stroustrup: Not in the slightest. Trouble is, most companies hush-up all their major blunders, and explaining a $30 million loss to the shareholders would have been difficult.. Give them their due, though, they made it work in the end.

Interviewer: They did? Well, there you are then, it proves O-O works.

Stroustrup: Well, almost. The executable was so huge, it took five minutes to load, on an HP workstation, with 128MB of RAM. Then it ran like treacle. Actually, I thought this would be a major stumbling-block, and I’d get found out within a week, but nobody cared. Sun and HP were only too glad to sell enormously powerful boxes, with huge resources just to run trivial programs. You know, when we had our first C++ compiler, at AT&T, I compiled ‘Hello World’, and couldn’t believe the size of the executable. 2.1MB

Interviewer: What? Well, compilers have come a long way, since then.

Stroustrup: They have? Try it on the latest version of g++ — you won’t get much change out of half a megabyte. Also, there are several quite recent examples for you, from all over the world. British Telecom had a major disaster on their hands but, luckily, managed to scrap the whole thing and start again. They were luckier than Australian Telecom. Now I hear that Siemens is building a dinosaur, and getting more and more worried as the size of the hardware gets bigger, to accommodate the executables. Isn’t multiple inheritance a joy?

Interviewer: Yes, but C++ is basically a sound language.

Stroustrup: You really believe that, don’t you? Have you ever sat down and worked on a C++ project? Here’s what happens: First, I’ve put in enough pitfalls to make sure that only the most trivial projects will work first time. Take operator overloading. At the end of the project, almost every module has it, usually, because guys feel they really should do it, as it was in their training course. The same operator then means something totally different in every module. Try pulling that lot together, when you have a hundred or so modules. And as for data hiding. God, I sometimes can’t help laughing when I hear about the problems companies have making their modules talk to each other. I think the word ‘synergistic’ was specially invented to twist the knife in a project manager’s ribs.

Interviewer: I have to say, I’m beginning to be quite appalled at all this. You say you did it to raise programmers’ salaries? That’s obscene.

Stroustrup: Not really. Everyone has a choice. I didn’t expect the thing to get so much out of hand. Anyway, I basically succeeded. C++ is dying off now, but programmers still get high salaries — especially those poor devils who have to maintain all this crap. You do realise, it’s impossible to maintain a large C++ software module if you didn’t actually write it?

Interviewer: How come?

Stroustrup: You are out of touch, aren’t you? Remember the typedef?

Interviewer: Yes, of course..

Stroustrup: Remember how long it took to grope through the header files only to find that ‘RoofRaised’ was a double precision number? Well, imagine how long it takes to find all the implicit typedefs in all the Classes in a major project.

Interviewer: So how do you reckon you’ve succeeded?

Stroustrup: Remember the length of the average-sized ‘C’ project? About 6 months. Not nearly long enough for a guy with a wife and kids to earn enough to have a decent standard of living. Take the same project, design it in C++ and what do you get? I’ll tell you. One to two years. Isn’t that great? All that job security, just through one mistake of judgment. And another thing. The universities haven’t been teaching ‘C’ for such a long time, there’s now a shortage of decent ‘C’ programmers. Especially those who know anything about Unix systems programming. How many guys would know what to do with ‘malloc’, when they’ve used ‘new’ all these years — and never bothered to check the return code. In fact, most C++ programmers throw away their return codes. Whatever happened to good ol’ ‘-1’? At least you knew you had an error, without bogging the thing down in all that ‘throw’ ‘catch’ ‘try’ stuff.

Interviewer: But, surely, inheritance does save a lot of time?

Stroustrup: Does it? Have you ever noticed the difference between a ‘C’ project plan, and a C++ project plan? The planning stage for a C++ project is three times as long. Precisely to make sure that everything which should be inherited is, and what shouldn’t isn’t. Then, they still get it wrong. Whoever heard of memory leaks in a ‘C’ program? Now finding them is a major industry. Most companies give up, and send the product out, knowing it leaks like a sieve, simply to avoid the expense of tracking them all down.

Interviewer: There are tools …

Stroustrup: Most of which were written in C++.

Interviewer: If we publish this, you’ll probably get lynched, you do realise that?

Stroustrup: I doubt it. As I said, C++ is way past its peak now, and no company in its right mind would start a C++ project without a pilot trial. That should convince them that it’s the road to disaster. If not, they deserve all they get.. You know, I tried to convince Dennis Ritchie to rewrite Unix in C++..

Interviewer: Oh my God. What did he say?

Stroustrup: Well, luckily, he has a good sense of humor. I think both he and Brian figured out what I was doing, in the early days, but never let on. He said he’d help me write a C++ version of DOS, if I was interested..

Interviewer: Were you?

Stroustrup: Actually, I did write DOS in C++, I’ll give you a demo when we’re through. I have it running on a Sparc 20 in the computer room. Goes like a rocket on 4 CPU’s, and only takes up 70 megs of disk.

Interviewer: What’s it like on a PC?

Stroustrup: Now you’re kidding. Haven’t you ever seen Windows ’95? I think of that as my biggest success. Nearly blew the game before I was ready, though..

Interviewer: You know, that idea of a Unix++ has really got me thinking. Somewhere out there, there’s a guy going to try it.

Stroustrup: Not after they read this interview..

Interviewer: I’m sorry, but I don’t see us being able to publish any of this.

Stroustrup: But it’s the story of the century. I only want to be remembered by my fellow programmers, for what I’ve done for them. You know how much a C++ guy can get these days?

Interviewer: Last I heard, a really top guy is worth $70 — $80 an hour.

Stroustrup: See? And I bet he earns it. Keeping track of all the gotchas I put into C++ is no easy job. And, as I said before, every C++ programmer feels bound by some mystic promise to use every damn element of the language on every project. Actually, that really annoys me sometimes, eve. I almost like the language after all this time.

Interviewer: You mean you didn’t before?

Stroustrup: Hated it. It even looks clumsy, don’t you agree? But when the book royalties started to come in … well, you get the picture.

Interviewer: Just a minute. What about references? You must admit, you improved on ‘C’ pointers.

Stroustrup: Hmm. I’ve always wondered about that. Originally, I thought I had. Then, one day I was discussing this with a guy who’d written C++ from the beginning. He said he could never remember whether his variables were referenced or dereferenced, so he always used pointers. He said the little asterisk always reminded him..

Interviewer: Well, at this point, I usually say ‘thank you very much’ but it hardly seems adequate.

Stroustrup: Promise me you’ll publish this. My conscience is getting the better of me these days.

Interviewer: I’ll let you know, but I think I know what my editor will say.

Stroustrup: Who’d believe it anyway? Although, can you send me a copy of that tape?

Interviewer: I can do that.

So this interview is fake, obviously. Or is it…? Nah, it’s fake.

But it went viral and for good reason: it could be true. Because we all like to poke fun at what a bloated mess C++ is. And for that reason it’s not really used anymore.

I mean, sure, if you’re working on low level stuff it’s mostly still used because the only other language you can use is C. Although Rust is getting popular.

But when was the last time you saw a high level framework using C++?

Declarative Programming And Declarative UI Explained All Aboard The Hype Train. Choo Choo!medium.com

How It’s Happening To C#

I don’t want this same fate to happen to C#. But unfortunately it is.

I first started to suspect this was the case when I saw C# 8’s new switch expressions. Basically (from the C# 8 documentation you can now define a switch statement like this.


public static RGBColor FromRainbow(Rainbow colorBand) =>
	colorBand switch
		Rainbow.Red => new RGBColor(0xFF, 0x00, 0x00),
		Rainbow.Orange => new RGBColor(0xFF, 0x7F, 0x00),
		Rainbow.Yellow => new RGBColor(0xFF, 0xFF, 0x00),
		Rainbow.Green => new RGBColor(0x00, 0xFF, 0x00),
		Rainbow.Blue => new RGBColor(0x00, 0x00, 0xFF),
		Rainbow.Indigo => new RGBColor(0x4B, 0x00, 0x82),
		Rainbow.Violet => new RGBColor(0x94, 0x00, 0xD3),
		_ => throw new ArgumentException(message: "invalid enum value", paramName: nameof(colorBand)),

Like WTF. Why? What was wrong with the normal switch statement? So maybe you can make some justification for why this is better in very specific circumstances. Then what about:

In C# 9 you can omit the type so like:

private List<WeatherObservation> _observations = new();

Like, the var keyword is already controversial enough. Why do we need a second one?

Congratulations! You broke the internet.

Or how in C# 10 you can make a property for a property. It’s called C# Fields. OK, it’s for autoproperties. But I don’t know why you can’t just use a normal property.

It’s like- properties were supposed to make our lives easier. Not worse.

Git LFS — A Solution That Won’t Work To A Problem That Doesn’t Exist I originally used Git LFS on my game development journey. Why? I don’t know. I didn’t need it. But it was the hip new…andrewzuo.com

And It’s Just Going To Get Worse

Because C# has to have a new version every year. I don’t know why everyone is moving to rapid release cycles. Like I was using the Firefox 4 beta for a year and I was perfectly happy with that. But now? We’re on Firefox 91. Yeah, 91. Because apparently every browser has to be updated on a 4 week release cycle.

C# is updated on a yearly release cycle and Java is updated on a 6 month release cycle. I don’t know why this is. Like, programming languages do not go obsolete that fast.

Actually I sort of know why it is with Java. I suspect it has to do with the Open JDK. Old versions of the Open JDK do not get any updates so if you want to use a 5 year old version of Java, like what most companies are probably doing, you need to pay up. It’s sort of ingenious really.

Right now C# may not be that bad. But give it a few years. And soon we will be swamped in feature creep.

Premature Optimization: How Bad Is It Really? There is another term that is thrown around a lot. That premature optimization is evil. We’ve all heard it and have…andrewzuo.com

Just Don’t Use The Features

This is the biggest complaint about my argument. And I sort of agree. It’s why I didn’t post about this earlier. But you know, not using the features works now but if this pace of feature creep continues? Well, in the words of the above alleged interview:

And, as I said before, every C++ programmer feels bound by some mystic promise to use every damn element of the language on every project.

So what’s going to happen when all the C# tutorials start using super obscure syntax? What then?

I think when that happens a lot of people are going to stop using C#.

I Loved C#

The problem with C# was that it was always just too verbose. It copied that from Java. So much so that I often jokingly called it ‘Java#’.

So it would make sense if C# were adding features to cut down on that verbosity and they are doing that. But the way they’re doing it feels like they’re just adding a hacky fix instead of addressing the root problem.

Languages like Dart are saying, “How can we make this simpler?” while languages like C# are saying “How can we do exactly what we did before just with less code?”

And of course the answer they come up with is “just throw a macro at it.”

Sure, sometimes they think of adding something that’s genuinely useful. But a lot of the time they’re just adding fluff. Cognitive busywork. Sure, they addressed the problem of having to type too much. But the underlying problem, of complexity, is just getting worse.

There’s already reports that people are abandoning C#. Stack overflow’s trends show a precipitous decline in questions since mid 2009 and their annual surveys (with the exception of 2017–2018) show a slow and gradual decline in the language.

And if this level of bloat continues, I suspect a lot more will leave as well.

What Is State Management And Why You Should Use It If there’s one thing programmers love it’s making up new words for things. If there’s one thing programmers don’t love…andrewzuo.com

If you liked this post make sure to clap and hold down on the clap button until it reaches a number you’re happy with. Yeah, I know it sounds like cheating, but it’s not. Here’s how many claps I usually give:

0 -> Don’t Agree/Didn’t Read 1 -> Neutral, but I’ll give you a pity clap ~4 -> Don’t like all of it, but there are some good points ~16 -> This is a pretty good article ~50 -> Everyone needs to read this!