Let's continue the programming languages and ecosystems series with the .net family in this post.
Origins and first principles
.NET framework was introduced almost 20 years ago (initial release in 2002). The .NET framework was basically Microsoft's version of Java as a modern replacement for C++.
Similar to Java, design goals were-
Modern, Simple, object-oriented - Goal was to provide a familiar language as C++ but one that would serve for the next decades. A common library for better reuse and developer productivity.
Architecture neutral and portable - .NET applications are run in a virtual machine that provides services like security, automatic memory management via garbage collectors, thread management etc. Common Intermediate Language was the java bytecode equivalent. And the Common Language Runtime is the virtual machine. The CLR performs just-in-time compilation to native code along with other optimizations at runtime.
Multiple language implementations - Unlike java, .net started with multiple language implementations from the start. The primary language was C#, but F# and VB.net were also actively developed. The Framework class library contained the core APIs along with extended libraries windowing, webapps, and much more.
At release, the framework and tooling was not open source and the deployment platform was windows. However if you were a Microsoft-based shop then this was common. Most tooling was controlled by Microsoft like Visual studio, MSDN and much more. This tooling was expensive but excellent.
Version history
The .net family version history has multiple actors. The core framework and libraries. C# language features and also Mono. Mono was an open-source implementation of the framework created outside Microsoft.
[.net framework] 2002 1.0 - The first release of the framework which runs on multiple windows flavors. C# looked very java-ish. There were some interesting features like structs, value types, properties and delegates.
[mono] 2004 1.0 - Mono is released by Ximian. Mono was an open-source implementation of the .net framework for Linux.
[.net framework] 2006 2.0 - C# Support for generics. Unlike java, C# generics were not based on type erasure and are technically better.
[.net framework] 2006 3.0 - UI subsystem and workflows. C# version 3 with lambda/closure making it functional, extension methods
[.net framework] 2007 3.5 - LINQ brought data querying capabilities to the language. It made it possible to write query expressions which were type safe to work with data from arrays, xml or databases. Heavily influenced by SQL and haskell, this was a massive feature when I first saw it.
LINQ allows operators like select, where, grouping, aggregation and other higher order data functions to the language. This later evolved into Reactive extensions with async programming.[.net framework] 2009 4.0 - Parallel LINQ and Task parallel library
[mono] 2009 - Mono running on apple devices. Static compilation of .net code for devices like iphones and game engines like playstation.
[mono] Ximian acquired by Novell, and then a new company Xamarin created.
[c#] 2012 v5 - async and await model for asynchronous promise based programming. The language added new keywords for asynchronous programming.
[.net core] 2014 - .net core was announced as a free, open-sourced and cross platform successor to the .net framework. This was a combination of work by microsoft on .net framework along with mono and released under the MIT license.
[c#] 2015 v6 - null propagation aka conditional programming based on nullability of references.
[.net core] 2016 v1 - Xamarin was acquired by Microsoft. .net core v1 was released
[.net core] 2018 v2 LTS release for longer support with c#7.
[.net core] 2019 v3 LTS release for longer support with c#8.
Community and ecosystem
.net's history and future is a direct reflection of the leadership of Microsoft. Under Ballmer's leadership; Microsoft believed that it could do it alone and crush competition. The older mindset of proprietary packaged software sales was based on past success. Ballmer absolutely understood how important developers are, but protection of the old business model made him also declare that "Linux is cancer" (along with the GPL license which then extended to open source software). Nadela's Microsoft is based on a growth mindset and they are actively embracing multi-platform, multi-vendor, multi-everything* to gain more market share. The Microsoft loves linux slide below was a shocker at that time and I was definitely unsure if it was part of a FUD campaign. However, the new Microsoft is working actively on many areas as a good citizen. This changed style is not because of any altruistic reason. Nadela needs to sell Azure more than visual studio licenses. Developers use macs, github and many other languages and platforms. Open source is part of the core ethos of a programmer. Vilifying them would doom the company.
C# has multiple features that are better than Java. Some are-
Unified type system in C# vs primitive types in Java
Struct types (passed by value) in C#. Java is working on this as part project valhalla.
Generics without type erasure.
Null operators - coalescing ?? and null conditional ?.
Partial classes (split class definition across multiple files).
Advanced parameters and arguments like in/out parameters, optional arguments, named arguments
Better support for creating internal DSLs.
language-level asynchronous programming model with async/await
C# the language started off looking very java-like. However as a language, C# has added features and innovated much faster than Java as shown in the list above. I'm not aware of how good the runtime performance of the stack is. Comparison of the languages shows some of the differences and version history for c# shows the main changes. Java has been extremely slow with features that need new keywords like async/await, or even better pattern matching. That space has led to languages like scala and kotlin. However adoption of C# has mostly been limited because of the Ballmer's Microsoft. Mono existed but was not good enough to help with the growth that the language had potential for. Innovations like LINQ led to frameworks like Rx which then evolved into the reactive streams initiatives in java and are now a cornerstone in high-scale systems. Nuget which is the package manager for .NET lists around 250k unique packages which seems low. However the community will take more time to transition and build.
Future
Positives
Microsoft is making the right moves in terms of its language and platform strategy by embracing open-source and expanding to all developers. .net core is bringing a unification of the windows and mono implementations. They are multi-platform and have a rich library, great language and are used actively in domains (on windows) for server-side programming and desktop programming. C# is used extensively in the gaming domain also. It is used for the scripting API of the Unity game engine (though the core engine is in the venerable C++).
When I used to work on Windows one of the first steps I would do for setup was install cygwin to get a proper shell. Now windows has become linux with WSL. That makes me want to consider windows as a proper development environment again.
.net and visual studio are install-able on mac and linux as well. Visual studio on mac is based on mono and looks extremely minimal .. but it's a start. For some reason the generated artifacts on mac end with the extension '.exe'!
Projects like .NET Multi-platform App UI aim to create a common UI codebase to be able to deploy to multiple platforms including desktop, mobile and web. Personally I’m skeptical about cross-platform UI and need to rethink about this space a lot more. It is the new vogue for almost all platforms though (see Google Flutter, React native)
For serverless lambdas at a high scale, it is important to have minimal startup time (cold-start) for the process. Server processes can start slowly and optimize critical paths later. However billing for serverless lambda depends on the duration that the process runs for and so faster startup saves costs. Faster startup also means reduced latency for calls. Hence many platforms are now working on implementation of ahead-of-time compilation (native binaries without a virtual machine interpreter) compared to the just-in-time compilation of java and .net There are docs around native compilation on windows but I’m not sure if it's available across all platforms supported by .net core. This is similar to Graalvm native from java.
Acquiring Github has been a great move for the company. It's an expensive way to pay for past sins. VS Code has been another great success for Microsoft built on open source. VS code is probably a de facto code editor on every developer's machine. Visual Studio is the full-featured IDE for all things Microsoft. The basic version is available for free for individual developers and small companies as well. This lowers the barrier for adoption.
All of these steps will pay dividends in the long run and it makes the company and .net very relevant again. Ballmer was absolutely right about the importance of developers. It will take a long time to rebuild trust and the team needs to continue shipping features and outreach at the same time. But positive posts like this one show how they are trending. It’s their P0 after all.
Negatives
All the names in the .net family have confused the hell out of me!
The community and library ecosystem are going to take time to mature. The platform will continue to be dominated by Microsoft.
Thanks to Bruno Sales, Rahul Saxena and anonymous for reading drafts of this.
Loved the storytelling Rahul! It's probably like after 15 years when I heard someone say "cygwin" :)