Twitter GitHub Facebook Instagram dirv.me

Daniel Irvine on building software

C# is too complex

24 June 2014

Reading over the proposed features for C# 6 gave me a terrible sinking feeling. It would appear that the only thing they haven’t yet added to the language is the kitchen sink. The beauty of the language has been lost.

There’s a famous interview by Herb Setter of Ritchie, Stroustrup, and Gosling, the creators of C, C++ and Java respectively, where the language authors are asked if they ever added features that their users didn’t appreciate. James Gosling answered by saying:

I had this personal rule that by and large I didn’t put anything in just because I thought it was cool. Because I had a user community the whole time, I’d wait until several people ganged up on me before I’d stick anything in.

Java has always been a pure-OO language. Although it now feels quite outdated, there’s a lot of beauty within it. C#, on the other hand, started out like Java but has now become the quintessential evolving language. It has changed almost beyond recognition since C# version 1 was released in 2000.

That’s understandable because its user-base is broad and Microsoft wants the language to appeal to as many groups as possible. For inexperienced programmers it must be versatile yet simple. For traditionalist programmers it must be static, verbose and clearly derived from C. For modernist programmers it must be dynamic, adaptable and concise. Attempting to be all of these things has left C# bloated and complex.

Gosling also gave a great analogy:

There’s this principle about moving, when you move from one apartment to another apartment. An interesting experiment is to pack up your apartment and put everything in boxes, then move into the next apartment and not unpack anything until you need it. So you’re making your first meal, and you’re pulling something out of a box. Then after a month or so you’ve used that to pretty much figure out what things in your life you actually need, and then you take the rest of the stuff -- forget how much you like it or how cool it is -- and you just throw it away. It’s amazing how that simplifies your life, and you can use that principle in all kinds of design issues: not do things just because they’re cool or just because they’re interesting.

C# just keeps on getting bigger, and it’s less beautiful as a result.

About the author

Daniel Irvine is a software craftsman at 8th Light, based in London. These days he prefers to code in Clojure and Ruby, despite having been a C++ and C# developer for the majority of his career.

For a longer bio please see danielirvine.com. To contact Daniel, send a tweet to @d_ir or use the comments section below.

Twitter GitHub Facebook Instagram dirv.me