Thomas Bandt

Is Node.js better than ASP.NET?

Coming a long way down the Microsoft Bubble Avenue and being a Microsoft MVP for ASP.NET since 2006, I always felt productive with my personal stack.

Published on Friday, January 16, 2015

Even ten years ago, when using a then-hip but bullshit concept called WebForms, I didn’t challenge the technology itself. Instead I found some workarounds and learned to avoid the main issues like PostBack and ViewState.

In 2007 Microsoft began to adjust its strategy by throwing ASP.NET MVC in the game, which gave us back our freedom and flexibility as web developers. In 2012 ASP.NET Web API followed, a nice REST-based framework.

All that was driven by some really smart guys working for the ASP.NET team at Microsoft and it eventually resulted in the large open source initiative in late 2014.

But despite all these efforts there has been this impression of ASP.NET lagging behind all these other frameworks used by the cool kids.

I used a short break after a long-running project in the last quarter of 2014 to reconsider my options.

To cut one part of this story short, after doing some research I don’t think Python/Django, Ruby on Rails or any of the almost infinite JVM frameworks have a more active community or a better standing in the industry than ASP.NET has. That may be wrong depending on the point of view, but I couldn’t justify to use one of these over ASP.NET to myself, so I moved on.

I ended up by digging somewhat deeper into Node.js. I remember a friend of mine trying to convince me to give this newest cool kid on the block a try back in 2010, which I refused as I couldn’t see any benefit over ASP.NET MVC back then.

But hey, it is still here - and it seems to be mature now. So I decided to build something real with it, something I would use in production. And while working on a ASP.NET MVC/AngularJS application by day, I wrote a new blog software with Node.js containing the most interesting concepts (MVC, templating, data access, etc.) by night in November and December.

Here is what I learned.

Traction

Looking for large ASP.NET driven websites is easy, finding some is hard. The adoption of Node.js by large players on the other hand is actively growing, including PayPal, Netflix, Ebay, LinkedIn, Uber and others.

So what’s my benefit of knowing how many large companies are using a specific technology? The thing is: the more large and fast growing companies and startups are using a piece of technology, the more people get attracted by it. It works like a self-fulfilling prophecy, even if the trending technology isn’t worth the hype.

And the more people and eventually smaller companies get on track, the more projects and jobs are on the market.

ASP.NET has its place in the enterprise field, but I don’t see any of the current or wannabe large players using it. So it will lose importance sooner or later.

Node.js vs. ASP.NET 1:0

The language

Yes, I definitely like C# more than I do like JavaScript. But does that matter? I have to write large parts of my applications in JavaScript anyway, as most things happen on the client side these days. So it’s not a big deal, and things will become even better with ECMAScript 6, which can actually be used today.

Node.js vs. ASP.NET 0:1

The community

If you compare the number of questions on Stack Overflow, ASP.NET MVC wins (as of today). But if you compare the available open source projects on GitHub and their activity, Node.js is the clear winner. It even benefits from some libraries that are available on both, client and server side (think of underscore.js).

Node.js vs. ASP.NET 1:0

Available packages

NuGet is growing, but as of today the numbers are clear: 325 million total package downloads on NuGet at all times, 665 million downloads in the last month alone on npm.

(Sure, many of these downloads are results of package restores, but you get the picture.)

And that’s not by chance. The whole concept of Node.js is based on small reusable libraries. If you take a look at the package.json of my blog you will find a lot of references to external packages.

Buying into that concept enables you to develop things very fast and with less self-written code. Sure, there are side-effects you have to be aware of (as the quality of the packages varies heavily), but all in all this culture of building and sharing small libraries is a huge benefit.

Node.js vs. ASP.NET 1:0

Platform autonomy

Over the last years I got used to work primarily on a Mac, only switching to Windows for using Visual Studio. That could end one day With ASP.NET 5, as they’re supporting not only hosting but also developing on all three major platforms. I think that will result in real platform independence, but it’s not production-ready yet.

On the other side, Windows isn’t a first-class citizen in the Node.js world. It has some limitations regarding the maximum length of file paths. And as npm packages can reference their own dependencies, this often leads to deep hierarchies which are simply not possible on Windows. It’s up to you whether you blame Microsoft or the Node.js developers for not addressing this issue, but the truth is, it’s there.

Node.js vs. ASP.NET 0:0

Development tools

You can develop ASP.NET with Sublime or Mono Develop, but using Visual Studio and ReSharper (and maybe Web Essentials and other plugins, too) is the standard. And there is nothing wrong with that, as it’s powerful, customizable and – once VS has started – fast.

From my point of view, the same is true with Node.js. You can develop it with every text editor, but productivity increases dramatically by using an IDE. I prefer WebStorm, which is as slow as Visual Studio with ReSharper when starting up, but a huge productivity booster when running.

Node.js vs. ASP.NET 1:1

Hosting

Hosting packages for ASP.NET applications are rare, and there are even less offers on the market for Node.js. I have chosen to walk the path down even further and to set up my own Linux web server. That was demanding for someone coming from the Windows universe and it took me some time, but I got it up and running and I am quite happy with it.

Node.js vs. ASP.NET 1:0 (Because there are no licensing costs.)

Conclusion

Adding up we are staying at Node.js vs. ASP.NET 5:2. Of course that’s highly subjective (and not very serious ;-))!

If you want to leverage a dynamic and fast-growing ecosystem with tons of stuff already available for almost every use case you can think of, then go ahead and make your bet on Node.js.

If you’re okay with the fact that the great next version of ASP.NET will need some time to arrive in the Linux wonderland and that there is a chance that it will never get any noteworthy traction, but you want to enjoy the advantages of C#, F# and so on, then you’re doing nothing wrong with ASP.NET.

Productivity can be high on both platforms, and to be honest, most things you need to build high-quality applications are already there in .NET.

I will still go with both, depending on the customer’s needs.

What do you think? Drop me a line and let me know!