There are two situations where I'd start another project in Node.js:
1) there's an unusual amount of logic shared between browser and server
2) a web layer needs to be isomorphic
Node hits a sweet spot for these, but it's not my choice any more for non-web servers like the micro-services that back up mobile and single page apps.
I abandon Node.js after a first project years ago because of the callback soup. I came back when promises promised an alternative. Now I run into situations where promises cascade up from a few async calls and affect every API built on top of them. Perhaps async/await will improve the situation.
I spent a lot of time with Docker in its early days, and now I work a lot with documentation. I dream of providing my readers with live, on-demand sandboxes they can use to play with our sample code before trying to run it locally.
Lots of services have cropped up in recent years to try and make this dream a reality. Unfortunately, most either require user registration or are defunct, and I suspect it's because preventing abuse and fraud are extremely difficult.
HyperDev is by far the best attempt I've seen yet. It's functional, doesn't require user registration, and provides a full URL I can use with other web APIs.
However, it may be challenging to build a full application based only on what you find in this book. I strongly recommend to get familiar with lodash, bluebird, jsdoc and learn to organize your code before writing web servers.
node is not a fuzzy warm friendly technology. Unlike web browsers in which your JavaScript is fully sandboxed and babyproofed, node is not. And many people learning node today do not learn what the event loop is, and how it is YOUR responsibility to not block it.
The golden rule of learning node is: trial and error might be fine while learning, but not for professional work. If you reach a point in which things seem to work, FORCE YOU TO UNDERSTAND WHY IT IS WORKING. If you don't follow this simple rule you will get yourself into REAL problems.
I worked through the Node Beginner Book by Manuel Kiessling some years ago and enjoyed it. I'll probably look through it again to see what has changed. But I'm increasingly (and approaching permanently) disillusioned with the Node/js space.
It just seems like a real mess. In general tooling needs more work than anything, for all languages but JS is a good conversation piece on what's wrong.
I understand this is just a dummy example, but to make the code easier to read and understand you should inline functions that are only used once, unless it has a lot of reusability. There's a fine line between abstraction and obscurity.
I've been using Node.js for 4 years now and it's my favourite runtime (I've been programming for 13 years).
I have a broad background with experience in Java, C/C++, Python and I've done AVR microcontroller programming in assembly and C so I know what I'm talking about.
I've found that most people who complain about Node.js tend to lack experience.
I think it's one of the best runtimes/languages for building web applications - In the same league as Tornado (Python) and Go.
Personally, I like it more than the others because I like JavaScript and it makes it easy to context switch between frontend and backend work.
People who have a background in statically typed languages tend to dislike JavaScript because it gives you more flexibility (and more ways to introduce issues into your app if you're not careful).
If you're just starting programming or you started with another dynamically-typed language, then I would highly recommend learning Node.js.
I get that you're making a joke (I think?), but this is hardly useful advice. You may not like Node.js, but it's a pretty useful skill to have given its current popularity.
I'm more interested in knowing why you'd give this advice to beginners (genuinely curious).
I agree with this statement completely. Nodejs allows (often encourages) beginner programmers to make terrible design mistakes and fail to teach how software actually works. Need something done? npm install, import, done. No you can't learn by doing that.
[+] [-] GarethX|9 years ago|reply
[+] [-] RUG3Y|9 years ago|reply
[+] [-] qohen|9 years ago|reply
[+] [-] cstrat|9 years ago|reply
[+] [-] KJBweb|9 years ago|reply
[+] [-] estebandvm|9 years ago|reply
[+] [-] glengoolie|9 years ago|reply
[+] [-] johnchristopher|9 years ago|reply
[+] [-] shorsher|9 years ago|reply
[+] [-] Daniel_Marcos|9 years ago|reply
[+] [-] Grangar|9 years ago|reply
[+] [-] cheriot|9 years ago|reply
1) there's an unusual amount of logic shared between browser and server
2) a web layer needs to be isomorphic
Node hits a sweet spot for these, but it's not my choice any more for non-web servers like the micro-services that back up mobile and single page apps.
I abandon Node.js after a first project years ago because of the callback soup. I came back when promises promised an alternative. Now I run into situations where promises cascade up from a few async calls and affect every API built on top of them. Perhaps async/await will improve the situation.
I'm curious where Node.js fits for other people.
[+] [-] yblu|9 years ago|reply
Can you elaborate what you meant by that?
[+] [-] jmtulloss|9 years ago|reply
[+] [-] asenna|9 years ago|reply
I'm loving that and the fact that it's so minimal - everything happens in small middlewares.
[+] [-] unknown|9 years ago|reply
[deleted]
[+] [-] cheez|9 years ago|reply
[+] [-] unknown|9 years ago|reply
[deleted]
[+] [-] torkalork|9 years ago|reply
I spent a lot of time with Docker in its early days, and now I work a lot with documentation. I dream of providing my readers with live, on-demand sandboxes they can use to play with our sample code before trying to run it locally.
Lots of services have cropped up in recent years to try and make this dream a reality. Unfortunately, most either require user registration or are defunct, and I suspect it's because preventing abuse and fraud are extremely difficult.
HyperDev is by far the best attempt I've seen yet. It's functional, doesn't require user registration, and provides a full URL I can use with other web APIs.
They're Node-only for now, but they're teasing more languages on Twitter: https://twitter.com/HyperDevIt/status/771766515603533829
I'm certainly rooting for them.
[+] [-] GarethX|9 years ago|reply
[+] [-] partycoder|9 years ago|reply
However, it may be challenging to build a full application based only on what you find in this book. I strongly recommend to get familiar with lodash, bluebird, jsdoc and learn to organize your code before writing web servers.
node is not a fuzzy warm friendly technology. Unlike web browsers in which your JavaScript is fully sandboxed and babyproofed, node is not. And many people learning node today do not learn what the event loop is, and how it is YOUR responsibility to not block it.
The golden rule of learning node is: trial and error might be fine while learning, but not for professional work. If you reach a point in which things seem to work, FORCE YOU TO UNDERSTAND WHY IT IS WORKING. If you don't follow this simple rule you will get yourself into REAL problems.
[+] [-] kang|9 years ago|reply
[+] [-] GarethX|9 years ago|reply
(useful for those working on locked-down School PCs etc.)
[+] [-] BuckRogers|9 years ago|reply
Not due to the language complaints alone from yesteryear. Rather left-pad and this, https://twitter.com/mitsuhiko/status/712624914071728128.
It just seems like a real mess. In general tooling needs more work than anything, for all languages but JS is a good conversation piece on what's wrong.
[+] [-] z3t4|9 years ago|reply
[+] [-] lkhatter|9 years ago|reply
[+] [-] mi100hael|9 years ago|reply
[deleted]
[+] [-] jondubois|9 years ago|reply
I have a broad background with experience in Java, C/C++, Python and I've done AVR microcontroller programming in assembly and C so I know what I'm talking about.
I've found that most people who complain about Node.js tend to lack experience. I think it's one of the best runtimes/languages for building web applications - In the same league as Tornado (Python) and Go.
Personally, I like it more than the others because I like JavaScript and it makes it easy to context switch between frontend and backend work.
People who have a background in statically typed languages tend to dislike JavaScript because it gives you more flexibility (and more ways to introduce issues into your app if you're not careful).
If you're just starting programming or you started with another dynamically-typed language, then I would highly recommend learning Node.js.
[+] [-] haswell|9 years ago|reply
I'm more interested in knowing why you'd give this advice to beginners (genuinely curious).
[+] [-] ralusek|9 years ago|reply
[+] [-] ruler88|9 years ago|reply
[+] [-] svanderbleek|9 years ago|reply
[+] [-] mlvljr|9 years ago|reply
[deleted]