I do quite a bit of ASP.NET work (C#, MVC), but most of it is typical web development. I do Restful architecture using CRUD repositories. Most of my clients don't have a lot of advanced requirements within their applications.

I'm now looking at node.js and it's performance implications (I'm addicted to speed), but I haven't delved into it all that much.

I'm wondering if

node.js can realistically replace my typical web development in C# and ASP.NET MVC (not rewriting existing apps, but when working on new ones)

node.js can complement an ASP.NET MVC app by adding some async goodness to the existing architecture.

Are there use-cases for/against C# and node.js?

Edit

I love ASP.NET MVC and am super excited with where it's going. Just trying to see if there are special use cases that would favor node.js

Yes, I realize this can be a bigger conversation when including Ruby, or PHP, but for this particular question, I'm not interested in either of those... that's just me.
–
Chase FlorellDec 8 '11 at 19:17

The answer is, try node. Read up about it. See whether you like it.
–
RaynosDec 8 '11 at 20:00

2 Answers
2

I'm now looking at node.js and it's performance implications (I'm addicted to speed), but I haven't delved into it all that much.

Profile, profile, profile. That's the only way to know that your speedups are having the proper affect. You can guess that it's fast enough. But most people like to prematurely optimize. That's worse than playing with yourself during a date.

I'm wondering if node.js can completely replace my typical web development in C# and ASP.NET MVC, if it's better as a complement to C# and ASP.NET MVC, or if there's some things that should just "leave well enough alone".

Are there use-cases for/against C# and node.js?

Sure, if you're in a shop that routinely writes code in C#, then you should use MVC (it's a lot better than WebForms, and is called WebPages). You're going to not lose a lot of time to tooling training, and it's something your workflows should already handle.

What you don't seem to indicate above is the reasons to choose each. You've given two current market options, one still in Alpha stages, the other on its full third year of platform release. I wouldn't want to compare the current testing model electric cars with the Honda hybrids that are already out on the market. They're in two different leagues.

Now, here's a reason for you to stay away from node.js, if you're nominally a C# shop.

You don't currently work in asynchronous evented i/o, you currently work in a procedural format.

That's the antithesis to what nodejs is going to do for you.

However, if you're frequently writing async code in C#, and you use it a lot in an evented style, then yes, node.js is for you to strongly consider.

Here's what you'll give up:

IIS - This is actually important to a lot of people. Things like native A/D integration are already done, and pretty bug-free. Actually node.js now integrates well with IIS.

Razor templating - If you've done any serious C# MVC, then you are using and loving Razor and how quickly you can churn things out. There are similar templates in node, and I'm certainly not knocking node, but the entire toolchain is already present in C#, and a lot of it is currently being built in node world. NB: a lot of this tooling is now rather mature_

compile-time building of dlls - node.js generally gets compiled on the fly, that is to say, not all paths are checked at startup. It's entirely possible to have really bad code in node that nobody ever touches, checks, or tests against.

All the tools currently built into VS that you use daily - There just isn't that much VS support for javascript. Partly because everything in javascript is so dynamic. NB: Microsoft is obviously working on tooling support for javascript_

Here's what you'll gain:

everything you develop will be in the same language, assuming you do client side scripting as well as serverside. (or why would you even consider javascript on the server)

So, since I seem to be bashing Node here entirely, let me point out that node is my play language at home, I love it, and I help people debug it sometimes on the stackoverflow chat servers (room 642). I see that it has great and stupendous potential in the future.

I'm just saying, don't throw out the baby and wonder why the bathwater is dirty.

You haven't given a reason why you should give up your years of experience and start on something new. Are either bad tools? Not at all. Both are great and make development a breeze.

Can node replace C#? Yes, quite certainly. So could PHP or Java or Ruby. You're not asking about those.

Here's how you know when you're ready to program node.js instead of C#:

You're considering writing a book to help other people "get javascript" instead of the boring old programs they've written before in C# and etc.

You aren't using ANY libraries in C# other than the default MVC and that just for routing, and you're pretty sure that you can do a better routing engine, and you're coding everything as close to the metal as you can.

Every data object you design you see as a hash instead of a strongly typed object.

My advice, go write three or four complex websites in node.js. Start small, then get larger.
–
jcolebrandDec 8 '11 at 19:21

1

I'm not in college/university. I've been developing solo for around 8 years and am doing quite well for myself. I can make better $$$ on my own than under another company.
–
Chase FlorellDec 8 '11 at 19:23

1

C# does compile time checking of all the code paths. It won't throw until bad data blows it up. Node won't stop the build just because of bad code. Or I was using an old version and that's changed.
–
jcolebrandDec 8 '11 at 19:45

1

@Raynos: Razor is not some third-party open source project, it is the officially endorsed developed-by-Microsoft view engine for ASP.NET MVC 3
–
Carson63000Dec 8 '11 at 20:57

If your just doing restful architecture using CRUD repositories there is no good reason to port an existing application to node.js.

If your writing a new application that does REST and CRUD there may be good reasons to use node.js from the start.

It's really per application dependent.

For example personally I would write REST/CRUD applications fully in node.js because it's personal preference. Node is great to develop in, ASP.NET MVC was an annoying restrictive framework for me.

Verdict: Both tools get the job done. If there are no specific requirements that favor .NET or node then use whatever you want. i.e. It's personal preference.

However I can list some of the obvouis benefits of both platforms

ASP.NET

Windows/.NET integration. If you want your microsoft stack to be tightly coupled and highly integrated then you want .NET

readily available work force

Monolothic frameworks that hold your hand

Has a set of features that work out of the box. If your happy with these features it improves productivity. If you want custom features instead you end up fighting against the tool and reduce productivity.

Node.js

Single language for your entire web stack (if your using noSQL databases that use js for their "queries" like couch/mongo).