SteGriff

Blog

Next & Previous

Is .Net imitating Node.js?

Recently .Net has had big changes inside and out. On the inside, the “my first program” in C# and .Net is a lot shorter than it was. And on the outside, .Net is now on a yearly major version release schedule.

This is a bit of a personal theory incoming, but I think it all bears out in reality… hear me out…

What is Node.js like?

It’s quick to get started

Your boilerplate web API project with express in Node.js is a very simple thing:

const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => {
  res.send('Hello World!')
})

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})

…and anyone with a bit of JavaScript can jump into a new Glitch project, read a few docs, and write a live web API in minutes.

You can make powerful web projects very quickly

For years Node.js has been letting hacker types throw together amazing web projects in a short time [citation needed].

Speaking from personal experience, if I wanted to write an API to take text and render it as an SVG or return the most prevalent colours in an image or perhaps obscure the origin of a zip file and present it in the browser as a docx then I can knock that together in Node in 1 or 2 hours. These are things that would take at least a day of fiddling in .Net.

In fairness, some of this is down to npm vs nuget package ecosystems. But it’s a chicken-egg thing. The more users you have in the ecosystem, the more high quality packages you have, the more devs you attract, 🔁

It’s always relentlessly updating

NodeJS version schedule will make your head spin. You thought you were up to date because you just got onto NodeJS 12. I mean, it sounds like a big number. GUESS AGAIN!

The NodeJS release cadence features a new major version number every six months!

Importantly, even-numbered versions get Long-Term Support (LTS)

So don’t even bother with the odd ones.

Example:

Why would .Net want to change?

Here’s a bit of guesswork:

What would it look like to copy these attributes?

Well maybe you would:

Make empty projects simpler

The new “hello world” console app has gone from 11 lines to 1 (and while it used to feature six keywords, using, namespace, class, static, void, and string, it now features… none)

Your most basic web API project has gone from 22 lines to 4 (and from looking like a birds nest to looking like understandable code)

This article, .Net 6 Minimal APIs vs Node JS covers it way better than I want to.

Release more often

Meet the new .Net release schedule:

Sounds familiar.

Not quite the same frightening clip as Node maintains, but we had .Net Framework 4.x for… (checks watch)… 12 years – so this is a real leap.

Why is this maybe a good or not so good idea

Copying Node.js in 2021/2, as if it’s the hotness, feels like an anachronism ten years out of place. Like saying “we should be getting into DVDs!” in 2012.

Nonetheless – what they’re imitating might be good ideas, regardless of time and provenance:

Wrapping up

This article has ignored a whole category of other design leanings to do with running .Net on Linux and the cloud and stuff. But I wanted to focus on just these two things.

So, that’s my headcanon about why MS is doing these things with .Net. I hope you enjoyed it. Like and subscribe haha jk.