and unreadable • They cloud the intent and readability of your code • Node.js APIs are generally asynchronous making it a frequent victim Tuesday, March 27, 12
err console.log "I was unable to buy milk. I thought milk was ubiquitous?" else I.willBuyIceCream (err, iceCream) -> if err console.log "Sadly, I was unable to buy ice cream" else I.willBuyChocolateSyrup (err, syrup) -> if err console.log "Argh! So close, yet I will still not have a milkshake" else console.log "I drink it up!" Tuesday, March 27, 12
"I was unable to buy milk. I thought milk was ubiquitous?") .then( (iceCream) -> I.promiseToBuyChocolateSyrup() (err) -> console.log "Sadly, I was unable to buy ice cream") .then( (syrup) -> console.log "I drink it up!" (err) -> console.log "Argh! So close, yet I will still not have a milkshake") Tuesday, March 27, 12
is a function where the first argument is an error and the next is a result. • ncall takes a function, an object to execute that function on, and any arguments the function may take Tuesday, March 27, 12
performing a series of operations • Node-fibers (https://github.com/laverdet/ node-fibers) • Provides a blocking style way of executing asynchronous code • Utilizes continuations to defer stack execution until asynchronous operation has completed • Async (https://github.com/caolan/async) Tuesday, March 27, 12