3 ms·
To clarify: HTML5+JS is only suitable as a replacement to the presentation portions of .NET (so WPF or WinForms), which are just a small portion of everything
by nxn 15y ago
To clarify:
HTML5+JS is only suitable as a replacement to the presentation portions of .NET (so WPF or WinForms), which are just a small portion of everything that .NET is. Think of .NET as being a Humvee and HTML5 and JS as a motorcycle, and developing your application as going to some remote location in Alaska -- while the motorcycle will look great, it will only get you so far, and you need something more for the rest of the road that can also carry a motorcycle if need be.
JS is a language that primarily lives in the browser and doesn't come with anything that would allow you to access much of the computer it is running on. We're talking about applications that will be executing natively here, so things like access to the file system are a must. You can of course try to use something that implements the CommonJS spec, like NodeJS, but are you honestly going to throw out the massive amount of libraries Microsoft created for doing IO, database connectivity, concurrency, networking, and a whole lot more, for something as minimalistic as an implementation of the CommonJS spec?
There are other problems on top of this. People say JavaScript is "fast", and it's true when compared to JavaScript a few years ago, but it is not true when compared to most .NET languages. Objects essentially being associative arrays in JavaScript means accessing a value that is deeply nested in a hierarchy of objects is slow. While even a problem now, it would get much much worse if you were to throw in the large number of libraries needed to make HTML5 and JS into a general application development framework. Stuff like: Com.Company.Project.Class.Member.Member.Method(); simply takes too much time in JavaScript. Same story for deep inheritance chains you often see in desktop apps.
Another problem: If your whole application is going to be in HTML5+JS, your whole application's source code is going to be public. You can try obfuscation, but I personally wouldn't put much faith into that approach.
.NET was built from the ground up as a whole application development framework -- it does this well. While HTML5+JS overlap with .NET in some areas, their scopes are still much smaller in comparison, and are therefore not suitable as complete replacements to .NET.