Things I love and hate about Node.js
I thought I’d try one of those link bait articles…
LOVE
- Threads/no threads – since everything runs in the same thread, but written as if there are many threads via callbacks, it makes for easy multi-threaded apps. Just make sure you keep things simple, using tools like asyncjs to control multiple callbacks- you dont want a callback pyramid of doom!
- Lightweight/fast – its a VM based language like Java and C#, but is already very fast to start.
- Same language client/server – less brainfarts when switching between code for the front end and the back end
- Dynamic – no need to tell the compiler what type things are, it works out what you mean.
- Its new and cool :)
HATE
- Its Javascript – there seem to be lots of “bad parts” to the language. Thus I code my Javascript via Coffee Script :)
- OTT braces and semi-colons – [code]function() { var a=1; }[/code]. Probably this is hang up from seeing too much Java/C#
- Function based programming – and not in a Lisp like way – every other line seems to be a new function definition.
- Variable declarations – declarations get pulled up to the top of the block, so things might not work as you expect
- == versus === – see the bad parts link above :(
- No types – especially in function parameters. So you can get problems when you miss a parameter and so the function is doing the wrong thing with the wrong parameter…
I am still in the “honeymoon” phase – its benefits seem to outweigh the disadvantages. Lets see what happens over the next 6-12 months…
Good summary, thanks!