4.1_node.js - MartijnKeesmaat/dating-app GitHub Wiki
Why is it used?
Node is weird in that you can’t really put it in most development tech boxes.
- It's not a programming language used almost exclusively for developing back-end web applications, like PHP or Ruby — though you can develop back-end web applications.
- It’s not a framework or library, though there are NodeJS frameworks and libraries — ExpressJS, and many others
- It’s not a package manager, though there are several node package managers — npm by default, as well as bower and several others.
There are 5 main things people use node for.
- Package management through npm, bower, jspm, etc.
- Development tooling (module management with webpack, task running and automation through grunt or gulp, linters like eslint or jslint, etc)
- Creation of back-end web applications.
- Command line tools like rimraf.
- Desktop applications.
Pro's
- Javascript is one of the most commonly known programming languages, and where much of the growth in the field is taking place. Being able to write your apps front-end and back-end in the same language is truly sublime.
Cons
- The fact that node is single-threaded, though you can use web workers, can cause performance and scaling headaches for extremely large applications (especially if you don’t use streams).
Npm dependencies
NPM & left-pad: Have We Forgotten How To Program?
Have we forgotten how to program?
-
There’s a package called isArray that has 880,000 downloads a day, and 18 million downloads in February of 2016. It has 72 dependent NPM packages. Here’s its entire 1 line of code:
return toString.call(arr) == '[object Array]';
-
There’s a package called is-positive-integer (GitHub) that is 4 lines long and as of yesterday required 3 dependencies to use. The author has since refactored it to require 0 dependencies, but I have to wonder why it wasn’t that way in the first place.
-
A fresh install of the Babel package includes 41,000 files
-
A blank jspm/npm-based app template now starts with 28,000+ files