Live data from Hacker News

Why I'm Learning Node

rdegges.com

61–65 of 65 posts

Re: Why I'm Learning Node

#61
post #21
post #16

As noted somewhere else learning node is not learning front-end. Something that bothered me recently is that on the back-end we are used to big oop frameworks when in fact the stateless nature of http do not match oop so well. On the front end however we have a gui so oop is a good paradigm.

Huh? What does the statelessness of HTTP have to do with OOP, particularly on the server, but not the client?

You're doing it wrong. HTTP is a stateless protocol. The very same reasons why it is so, should also enlighten you of why you shouldn't do what you're possibly implying.

EDIT: ops, replied to the wrong message. This is in reply to heyImAlex

Re: Why I'm Learning Node

#62
post #46
post #29

Earlier quoted context omitted.

The decrease in productivity with node comes from having to write everything with callbacks. Programming asynchronously is crazy, it makes very simple algorithms very annoying to write. I'd say it's almost like writing in assembly. You have to write your code in some pseudo code first, synchronously, then translate that into the asynchronous callback spaghetti than node requires. > Lastly, I would like to know what y…

> I'd say it's almost like writing in assembly. You have to write your code in some pseudo code first, synchronously, then translate that into the asynchronous callback spaghetti than node requires. This is a sign of a not-fully-adopted paradigm shift. Like, when someone first learns a new (spoken) language, they translate it to their native language in their head. Fluent speakers don't translate, they simply underst…

> Similarly, when you fully grok functional programming, coding with callbacks will cease to feel unnatural.

I don't understand this comment. Javascript, while having first-class functions, does not have call/cc. This is the source of complaints that Javascript encourages callback-spaghetti. As people have mentioned elsewhere, continuation-passing style is meant for compilers, not humans.

Re: Why I'm Learning Node

#63
The author refers to this seething criticism of node (http://teddziuba.com/2011/10/node-js-is-cancer. html), that I've seen before, and then just soldiers on without addressing it. I'm not well versed enough to know whether Dziuba's analysis is not the mark or not. What do the javascript/node experts here have to say about it? The criticism, after all, would seem to be so damning that it either needs to be refuted or to stand as a definitive reason to never seriously consider using node in a real project.

Re: Why I'm Learning Node

#64
post #46

Earlier quoted context omitted.

> I'd say it's almost like writing in assembly. You have to write your code in some pseudo code first, synchronously, then translate that into the asynchronous callback spaghetti than node requires. This is a sign of a not-fully-adopted paradigm shift. Like, when someone first learns a new (spoken) language, they translate it to their native language in their head. Fluent speakers don't translate, they simply underst…

> Similarly, when you fully grok functional programming, coding with callbacks will cease to feel unnatural. I don't understand this comment. Javascript, while having first-class functions, does not have call/cc. This is the source of complaints that Javascript encourages callback-spaghetti. As people have mentioned elsewhere, continuation-passing style is meant for compilers , not humans .

Thanks! I couldn't have phrased it any better.

This is why I said it's like writing assembly.

Re: Why I'm Learning Node

#65
post #55
post #50

Earlier quoted context omitted.

Or Haskell, Erlang or various other languages that have better solutions for non-blocking I/O.

Or C, C++, Java, Python or Ruby. Every language has solutions for non-blocking I/O, even the boring ones.

C doesn't have a good solution for non-blocking IO. Managing callbacks and their lexical scopes manually is quite painstaking.

User-level threads are non-standard, and ordinary threads are too heavy. All forms of threads lose much of C's benefit due to the relatively heavy stack allocation per thread.

Post reply on HN