Why you should consider learning .NET

hliyan
6 min readDec 4, 2024

--

Source: https://learn.microsoft.com/en-us/dotnet/architecture/modern-web-apps-azure/common-web-application-architectures

As I’m sure I have mentioned before, I spent the first 10 years of my career writing C++ code. Much of it was highly complex, mission critical work, but at the end of those ten years, the “skills” section of my CV had only 3 lines: “C++, Oracle, Unix”. I had considerable depth in my chosen domain and tech stack, but was severely lacking knowledge in others.

And that is why I spent 2013–2015 teaching myself the popular languages/stacks of the day: PHP, JavaScript, Python and Golang. Of all the languages above, the one that really resonated with me at the time was JavaScript, in no small part thanks to Node.js — a backend platform that was versatile, easy to write code in, had lot of library support, and was faster than its main competitor at the time (which was PHP). So much so that I wrote an article titled Why you should learn Node.js, which, apart from minor adjustments, remains valid to this day.

So it may come as a surprise to my regular readers that I am now writing an article titled “Why you should consider learning .NET”. Let me explain:

When .NET first entered my radar during my university days (around 2002–2003), it was a clunky behemoth pushing a new, untested language (C#) and was aggressively limited to Windows. At the time, I was happily developing server applications using J2EE (now Java EE), that investing any significant time in .NET felt like a waste. And so the status quo remained for the next 10 years.

My first .NET reference. Yes, we used actual, printed books back then.

And then in 2014, something rather unthinkable happened: Microsoft, which was almost universally hated by developers such as myself for its repeated attempts to scuttle anything open source that was not Microsoft, released an open source, cross platform version of .NET. Unfortunately, this was around the same time I was heavily investing in the JavaScript ecosystem as my primary, and Golang as secondary. So naturally I had neither time nor brainpower left over to master a third.

Then, in April of 2021, on a day I had some free time, almost on a whim, I did this (whenever I learn something new, I note down what I did in a secret Gist, so that I won’t have to re-learn it in the future):

Link to Gist: https://gist.github.com/hliyan/5d2c9e275cad01c4eaaa256b9899bad0

I had the whole thing running in a matter of minutes, using a few entries on the command line (just the way I like it), and on a Mac, no less. No fiddling with Visual Studio or any of the old Windows-only baggage that .NET used to come with. The app complied within seconds, and ran with a remarkably low memory footprint, utilizing very little CPU.

This was a far cry from the .NET I ran away from years ago. More importantly, I had this persistent thought as I was working through my application: this feels like what Node.js would be, if it was compiled, type safe and did not require a massive node_modules directory (because it has a rich standard library).

Unfortunately, for the next two years, I couldn’t do much more with .NET Core because I was helping build a startup that was heavily invested in the Node/AWS ecosystem. Then in 2023, that startup, along with hundreds of others around the world, met its end due to the now notorious VC funding collapse of 2022/23.

While I was looking for fresh opportunities in the aftermath, I noticed that while JavaScript/React/Node.js jobs were on the decline (tech layoffs were in full swing at the time), the demand for .NET talent seemed relatively stable. It dawned on me that many large and medium scale enterprises outside the venture-backed startup world were built on .NET, and they seemed to work quite well. This should not come as a surprise, given that Stackoverflow, for the longest time, ran on two on-prem servers running .NET monoliths, and even now, handles 1.3 billion hits per month with just 9 web servers and 2 SQL servers.

So when I, with my co-founder Gehan, finally started our own company, we made .NET one of our preferred tech stacks. Nearly a year later, it is turning out to be not only a good investment, but a somewhat pleasurable platform to develop on. It does have its warts like any other platform, but they are all tolerable. For me, personally, the biggest pain point is having to work with GUIs, as someone used to running commands and writing scripts on *nix systems. Of course, you can write Powershell scripts, but I haven’t mastered that skill yet.

If you’re a Java or JavaScript developer who is considering transitioning into .NET, here is a brief FAQ that can help:

How do I get started?

  1. Download the current long term support version of the .NET SDK (currently 8.0) for your operating system: https://dotnet.microsoft.com/en-us/download/dotnet/8.0
  2. Follow this tutorial to create a simple Hello World console app: https://learn.microsoft.com/en-us/dotnet/core/get-started.

What’s the best way to learn C# syntax?

  1. If you want a practical guide that will help you learn as you write code, try this: https://goalkicker.com/CSharpBook/.
    If you can’t access the link above, here’s an alternate download link.
  2. When in doubt, always go to the official documentation. Microsoft also has a lot of video tutorials.

What’s a good tutorial to get some hands on .NET Core experience?

Follow this tutorial to create a simple Web API.

Who uses .NET?

Many large enterprises, including:

  • GE Aerospace
  • UPS
  • nopCommerce
  • Intuit
  • Siemens

And of course, Bing and StackExchange.

How is C# code compiled and run within the .NET runtime?

C# code is compiled by the C# compiler (part of the .NET SDK) into an intermediate language (IL) that can run on the .NET Common Language Runtime (CLR), which JIT compiles the IL code into native machine code.

Does .NET have a standard library?

Yes. It comes with a large, comprehensive class library that covers a wide variety of functionalities including collections, I/O (disk, network, database) and built-in frameworks for web application and API development. .NET is a batteries-included platform that requires very little third-party framework usage compared to Node.js.

What is the .NET third party library ecosystem like?

.NET’s version of NPM is NuGet. If you can’t find what you need in the standard library, you can usually find it here.

How does .NET handle non-blocking I/O?

C# provides async/await functionality similar to ECMAScript/JavaScript.

Are there any popular frameworks for developing REST APIs and microservices using .NET?

For most use cases, you can use ASP.NET Core built in Web API and Minimal API frameworks.

How do I access a database from within a .NET application?

You can use ADO.NET for direct SQL access to databases, or you can use Entity Framework, a built-in ORM for high level access. .NET also comes with LINQ (Language Integrated Query), which builds SQL-like query capabilities directly into C#.

How do I organize my code within a .NET project?

Compared to the Node.js projects, .NET projects use design patterns and separation of concerns much more consistently. E.g. Models to represent data, DTOs to represent data in transit, Repositories to access data, Services to provide business logic, Controllers to handle requests etc.

Clean architecture, is a popular layered architecture for .NET Core projects.

What about front-ends?

Connecting React/Angular single page applications to .NET Core Web APIs is a popular approach. Or, you can develop a ASP.NET Core MVC application.

How do I test a .NET application?

For unit testing you may use libraries such as xUnit, NUnit, Moq and NSubstitute. You may use the ASP.NET TestServer for testing APIs, or you may use a tool that sends actual HTTP requests, such as Postman. End-to-end testing can be performed using your favourite tool (Cypress, Selenium, Playwright etc.)

How do I deploy a .NET application?

You may use GitHub Actions, Azure DevOps Pipelines, Jenkins or any other tool. You may either publish your applications as self-contained executables, or onto cloud infrastructure (e.g. Azure App Service, AWS) or onto IIS. You may also containerize your services and deploy them onto Azure Kubernetes Service.

What IDEs should I use?

Visual Studio on Windows, Visual Studio Code on other platforms.

--

--

hliyan
hliyan

Written by hliyan

Designing and developing software for 20 years. Ex London Stock Exchange Group, Ex Sysco. Currently leading engineering at :Different. Views personal.

No responses yet