3 ms·
The most difficult part about Node or Javascript coding is technique and library selection - you will get contradictory advice because its so popular or in node
by taurath 12y ago
The most difficult part about Node or Javascript coding is technique and library selection - you will get contradictory advice because its so popular or in node's case new, and there are so many choices there is no single right way, and plenty of ways that may bite you.
- 64 bit ints (yup)
- Type system (you'll get over it)
- Async coding - everyone has a different standard, but it does work whichever way you do
- Exceptions - callbacks have err as first parameter, every time. You have to boilerplate. Promises you have to pass in an error function, you have to boilerplate. Could definitely be improved, but like handling async there aren't anything standard, just opinions at this point.
- always ===, hint your code
- OO stuff - absolutely. But its also not fundamentally an OO language, its much more flexible.
- Leaks - Tooling could improve a LOT. Finding and sticking to a technique is the biggest part, which can get harder as a team grows bigger. Show me 2 people with 5 years of javascript experience at different places, and you'll have 2 very different code styles.
If you're intent on making javascript with OO and aren't coding partially for a browser, use something else. If you want very easy asynchronous functionality with a very fast communications server, Node is pretty damn good. Node is great for breaking down complex tasks, as long as you have a good method of flow control (promises, async + callbacks, etc).
- api 12y agoQuestion is why you'd use it over Go, Java, C#, or even Python or Ruby. I picked it originally because there are lots of quickly-up-and-running plugins and similar things in the npm repository. Like I said the community is great. But the more I work with it, the more it hurts. Pain in a language should decrease with time as you work with it.
- taurath 12y agoIt certainly has for me - the hump is likely bigger due to how new it is. Its hard to settle into a good flow when there are 1000 possible flows to get into.