I've read everyone's post up to this point in this thread. And I really 
worried about the fact that many people here dislike callbacks in Node. 

Before I came to node world, I used C#, Java, Python, Ruby to write code 
running on server. And I don't like them. Why? because they are 
synchronous. They make an app that is asynchronous in nature (IMO most web 
apps are asynchronous, if not all of them) looks synchronous in code. Why 
this is bad? Because when programmer write code looks synchronous, they 
tend to think that the code executes synchronously. This unintentionally 
encourage programmer to write code that looks good but performs really bad.

Let's be realistic. I'm a compiler guy. I write compilers as part of my 
PhD. I can assure you that compilers are not that smart to optimize away 
the layers of abstraction you built to write your fancy looking code. I'm 
not going to sacrifice performance just for prettier code. People may say 
that prettier code are more reusable and maintainable. But I think that's a 
big lie. Reusable code are about algorithms, patterns, interfaces. Use 
generators or callbacks makes no difference in either of these three at all.

I love callbacks in node. They reflects how machine executes the code. I 
don't use any control flow libraries (I built some small control-flow 
utilities though; they are just tens of LOC, but powerful enough). I find 
the callbacks and event emitters very intuitive. I can even visualize how 
the code executes in my head by just reading the code. This means I can 
immediately get a sense of how the code performs, whether the algorithm it 
used is good or bad, by simply reading it. This is a huge advantage. I can 
use none of other server-side languages to achieve this.

I don't understand why people say that callbacks are not composable. They 
are absolutely composable if you use them correctly! Callbacks + good 
programming practice is enough to solve every program correctly and, more 
importantly, efficiently. Adding generators to node, IMO, is just trying to 
make node as lame as other lame languages (C#, Python, Ruby, Java... this 
list never ends).

On Monday, August 5, 2013 10:23:11 AM UTC-5, Christopher Probst wrote:
>
> Hi guys,
>
> today I read something about the upcomming es6 generator support and how 
> useful they are in combination with promises (Q library for instance).
>
> The problem with node is that it provides only asynchronous functions (and 
> synchronous.. pff).
> I think in order to use promised based io the node.js should support an 
> additional function for each asynchronous function in the future or maybe a 
> library which does this. 
>
> I know that the Q library already exports functions like "Q.denodeify" so 
> it's definitely not much work but it's still work.
>
> I've started with node a year ago and it is really a nice tool but I 
> always hated the callbacks. They are not composable, verbose and absolutely 
> ugly.
>
> What do you think about this issue ? Any chance direct support for this 
> will ever be added ?
>
> Regards,
> Chris
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to