QCon London: Microsoft’s C# now a contrarian choice?

QCon London: Microsoft’s C# now a contrarian choice?

Sam Cox, co-founder and CTO of a start-up called Tracebit, spoke at QCon London about his decision to use C# as a contrarian choice – showing the problems Microsoft has in convincing the wider development community of the benefit of its .NET platform.

Cox needed to develop Tracebit, a security product which works by creating canary services; if they get accessed, there may be an intrusion. The initial target was AWS, the database manager was PosgreSQL, but what should the programming language be? Common choices for a startup would include Python, TypeScript, Go or Rust; but he observed that C# was popular in the enterprise – the 5th most popular in Stack Overflow’s most recent survey – but barely used by startups. Reviewing startup jobs on Y Combinator, he found just three mentioning C#.

Sam Cox, co-founder and CTO of Tracebit, speaks at QCon London

C# caught his interest because it looked somewhat familiar to him as someone who knew TypeScript (invented by Microsoft’s Anders Hejlsberg who also created C#), and ticked the boxes for features he required, including static typing, a strong supply chain, good documentation, comprehensive libraries, and above all high productivity.

At QCon, Cox described how his company used C# for rapid prototyping, customer trials which won their first paying customer, and then how an urgent performance issue was found and solved. He used neither Windows nor Visual Studio. The first lines of Tracebit were written on Arch Linux, Cox said on his blog, and the product is now developed on MacBooks using JetBrains Rider and deployed to Linux on Arm.

Some features of C# highlighted at QCon

The features of C# as a programming language were important, but perhaps less so than the frameworks and libraries that come with it. Productivity features described by Cox include:

  • The dotnet command line tool, described as “a really nice way to scaffold a new application … it can manage my dependencies, it can build and run the code, it can test my code, it can format my code.”
  • The .NET Generic Host which makes it easy to manage services, including adding experimental services. “It’s very quick to iterate,” he said.
  • Built-in support for OpenTelemetry, a vendor-agnostic solution for processing telemetry data.
  • Entity Framework, the .NET object-relational mapping library, which enabled a code-first approach to database persistence. He was surprised, he said, by how well optimized the generated SQL turned out to be. Changing the data model is easy with dotnet migrations.
  • Language Integrated Query (LINQ)  which builds data queries into the C# language enabling strong typing and auto-complete in place of quoted SQL strings.
  • A .NET library called Dataflow which he used to solve a critical performance issue. The library enabled a slow process to be broken down into a pipeline of dataflow blocks, and he fixed the issue by inserting a new block to reduce the number of database transactions. It was “battle-tested and well documented,” he told QCon.
  • Performance. Cox referenced the performance efforts that go into each iteration of .NET as documented each year by Microsoft partner software engineer Stephen Toub.

Despite Cox’s positive experience with .NET, the fact that the talk was entitled Questioning Convention, and the relatively sparse attendance, shows that Microsoft has a substantial problem attracting developers to C# beyond its own huge ecosystem. There is also a likely demographic issue, with .NET developers tending to be older than average.

One of the factors that may put off developers is that although .NET is open source and MIT licensed, it is largely developed by a single corporation. Although .NET is overseen by the .NET Foundation, this is not highly regarded as a protector of its status. If Microsoft changed its policies, that could be detrimental to .NET, is that a concern for Cox?

“Obviously it’s at the back of your mind, but I don’t lose sleep over it,” he told DevClass. “Microsoft is incentivized to get people to use Azure … I think they are encouraged to keep that ecosystem thriving in order to attract people to Azure.”

What else puts off new entrants to .NET? In his session, Cox spoke of a lingering perception that .NET is expensive, verbose, Windows-centric, and legacy; where the reality, he said, is that it is free, open source, cross-platform, expressive and modern.

Microsoft could do more to address misconceptions, but is less likely to cede its control of the technology, for example by donating it to a more neutral foundation. There would also be risks in doing that, since involving more organizations in .NET development could slow down its evolution.

Long-time .NET observers may be intrigued to note how the success of TypeScript is now helping to promote interest in C#. Hejlsberg has seen all sides of these language trends. Delphi, which he created when at former developer tools company Borland, never came close to Microsoft’s Visual Basic in popularity, despite technical advantages; proving that technology choices are not made solely for technical reasons.