Is .Net imitating Node.js?

Ste Griffiths - Sep 16 '22 - - Dev Community

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}`)
})

Enter fullscreen mode Exit fullscreen mode

…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.

Retro-futuristic Japanese car concept

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

...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:

  • Node.js 19 comes out this November and is supported til June 2023 (8 months total)
  • Node.js 20 comes out April 2023 and gets 3 whole years of support, til April 2026.

Why would .Net want to change? 🤔

Here’s a bit of guesswork:

  • Starting a new .Net project means loads of boilerplate and some instant turn-offs
  • It’s hard for beginners to build things in .Net
  • People (who?) like the easy setup Node projects
  • JavaScript ecosystem has a reputation for being the “it” thing (probably mistakenly)
  • Someone at Microsoft thinks imitating the Node.js way would be a good idea

What would it look like to copy these attributes? 📋

A fluffy white cat copying a lucky waving cat toy

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:

  • Major version release every 12 months
  • Even-numbered versions are LTS for 3 years

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. What do you think?

. . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player