“Why would you ever want to use ASP.NET, are you still stuck in the 90’s?”, these are the exact words uttered by an old coworker of mine when I brought up the idea of considering using ASP.NET for a project we were about to start a couple years ago. I agreed with him for the most part at the time. Microsoft had developed a great language, great web framework and great tooling around it yet people were still not too happy about it. The primary reason we ended up not using ASP.NET for that project back then was because of how locked down the language and the framework was. Using ASP.NET meant paying for Windows Server licenses for our servers or sinking into some rabbit hole like Mono to be able to deploy our applications on Linux which was our platform of choice. But a lot has changed since then, Microsoft has really stepped up their game and has turned ASP.NET from being something you were forced to use because your employer was using it to something desirable by even the most hardcore hipster developers.
When I first learnt C# about 5 years ago, I thought it was the best programming language ever. But that excitement I had back then did not last very long as I started to find too many shortcomings in their offering. I started learning ASP.NET Core in the early days when the first public builds were available. My interest for ASP.NET Core and C# grew again as soon as Microsoft announced that it would be cross platform. See, the problem with Microsoft’s stack back in the days was not that it was a bad stack in terms of technical abilities, performance or most other metrics that mattered to a developer, the problem was that it was very locked down and you had to use proprietary paid Microsoft technologies like Windows Server and IIS to deploy your applications. This meant that the cost of running your services were going to be much higher compared to most other technology stacks, even Java which is C#’s biggest competitor. Even though the costs probably meant nothing for a big enterprise generating more revenue per year than what a typical developer would make in their lifetime, it mattered a lot for an early stage startup or a developer trying to launch something as a side project. Another stigma associated with Microsoft’s stack was that their technology was old and had a lot of old, deprecated and inconsistent API’s which made the whole stack feel bloated.
With the introduction of .NET Core, ASP.NET Core and newer versions of C#, Microsoft really changed the game. C# was already one of the top languages used in the industry, but this new direction Microsoft took really sealed their position and helped their stack’s adoption by a significant number. If you were living under a rock, .NET Core is a new framework released by Microsoft around a couple of years ago that fixed all the shortcomings of their stack before that. It is cross platform, performant, lean and best of all, open source. Nobody had thought that Microsoft would ever release anything that would run on any other platform than Windows, forget about a whole development platform that would work on Linux and Apple’s Mac OS X as well.
The terminology that Microsoft uses for the components of their stack can be a little confusing, so let me explain that briefly first:
C#
This is the name of the general purpose programming language Microsoft developed that is approved as a standard by ECMA. The latest major version of the language as of this writing is 7, but you can find the full history on Microsoft’s official history of C# page.
.NET Framework
This is a general purpose application framework that primarily uses C#. It can be used to create anything from desktop apps to mobile applications to web applications, however it is only supported on Microsoft’s Windows and Windows mobile platform.
.NET Core Framework
This is the new version of .NET that is cross platform and works on most major platforms that are not developed by Microsoft as well. Even though this is supposed to be the next generation of .NET framework, Microsoft still maintains the old .NET Framework.
.NET Standard
This is the name for the set of common core API’s that Microsoft is providing via .NET Framework and .NET Core to unify things so that libraries are cross compatible between different .NET systems.
ASP.NET Core
This is a web application framework that is built on top of .NET Core framework. This is the successor to ASP.NET which used to be Windows only.
Now that that’s out of the way, let’s dive into some of the things that Microsoft got right with their new tech stack that made me love C# and .NET Core!
From the outside, the whole new .NET Core ecosystem might seem like a sheep in wolf’s clothes situation to those that have not done much research as it’s easy to think that it’s just a new version of the old .NET Framework. That is not really the case though, Microsoft has been really pushing the boundaries to raise a new wolf ground up. One of the things that differentiates .NET Core from its predecessor is the slew of new features Microsoft added. The biggest feature is that the new stack is cross platform. And it’s not some half assed cross platform implementation like we have seen in the past with some other languages either, they rebuilt the whole core ground up with cross platform in mind. This also enabled the use of latest application packaging systems such as containers and Docker with .NET Core. They also developed proper tooling that will let you develop in their stack cross platform which is something that Microsoft has never done before.
Another major feature is the removal of the dependency on IIS, which was Microsoft’s web server. Microsoft created a new standalone embedded web server they call Kestrel, which not only removed IIS as a dependency but also enabled developers to create self contained applications that created much more flexibility when it comes to deployments. That is not all though, there are a ton of other features in .NET Core that the old .NET did not have. The official Microsoft .NET Core Guide is a good place to start if you want to learn more about the features.
The feature set does not just stop at .NET Core though, C# itself has been getting continuous updates with a lot of useful features being added all the time. Notably, highly sought out features like tuples, async/await, local functions etc. have been added to make programming in C# a lot more efficient.
Another great reason to start using .NET Core is the performance improvements. Microsoft is on top of the pack again when it comes to performance among the popular general purpose programming languages out there. Performance is a touchy subject in development community because the stack and tooling can only take you so far when it comes to optimizing your application for performance, rest is on the hands of the developer to implement. But what a development stack can do is encourage and enforce best practises for performance and optimize common usage scenarios so that performance can be maximized on a bigger scope, which is exactly what Microsoft did.
C# is an amazing language on it’s own and comes with many features built in that allow you to fine tune your application for performance, but the .NET Core team has been working hard on optimizing a lot of built in API’s for maximum performance. Even the earlier releases of ASP.NET Core got notable mentions from TechEmpower Benchmarks for their performance. There are numerous examples of companies leveraging the performance optimizations available in .NET Core like Raygun did to maximize efficiency. Microsoft recently released the latest version of .NET Core, 2.1 along with a huge changelog of performance improvements. The development team has been consistently pushing updates with performance optimizations since the new framework was released.
The biggest reason I picked up Microsoft’s stack again is versatility. Now that it is open source and cross platform, I can pretty much build everything with one stack. You can build desktop applications with UWP, cross platform mobile applications with Xamarin (now part of Microsoft), web applications with ASP.NET Core, real time applications with SignalR and a lot more. Heck, if you are a game developer you can also use Unity although that’s not made by Microsoft. I am all about using the right tool for the right job, and with this approach I can still do that while being able to use the language, tooling and API’s I am most familiar with and love. Best part is all of this is free!
Never thought I would say this since things were buggy on the earlier releases, but tooling is one of the best things about the .NET ecosystem at the moment. You have multiple ways of developing in multiple platforms. Microsoft’s primary IDE, Visual Studio is second to none if you like working with IDE’s. For those that like more control over their tooling and don’t require the hand holding that an IDE provides, there is Visual Studio Code which is their code editor and command line tools which allow you to build, test and develop applications without the bloat of a full on IDE. VS Code also has a ton of third party extensions that help make your development experience better.
There is also Visual Studio for Mac which is not the same thing as the Windows version, but still is a complete package that allows you to develop on Microsoft’s new stack on Mac OS. If you are on Linux or just want a different IDE than Microsoft’s offering, the company behind Android Studio, Jetbrains has released an IDE called Rider which is amazing and is my main tool for development on Mac. Rider is also available for all three major platforms. Microsoft’s Intellisense autocomplete system is the best I have found in any major development stack, and with addition of tools like Jetbrains ReSharper things cannot get more efficient. My primary development machine is a MacBook and I love how productive my workflow is with Jetbrains Rider or VSCode.
Microsoft has been investing time and engineering efforts in their stack for a long time which means they have a stable development stack, experienced and knowledgeable engineering teams and years and years of trust built up. The new .NET Core opens that up to an even bigger market while showing what a large corporation could do and how quickly they can turn things around. After the current CEO Satya Nadella got appointed, he started pushing the engineering and development side of the company further resulting in all these big changes, which makes sense since he came from an engineering background too. C# and .NET Core are probably the best things that have happened in the development space from Microsoft in a long time and I am glad they are doing what they are doing.