Escape from Callback Hell with Deferreds
Yuvi Panda
@yuvipanda
- To explain fundamentals of deferreds, using jQuery’s implementation for demonstration
- Show how hard-to-understand callback based code can be converted to clearer Deferreds based code
Outline
Tired of writing JS with so many nested callbacks that it looks like the Gaza Pyramid turned sideways? Thought you’ll never have to write synchronization code again but suddenly find yourself wanting to wait
on 5 callbacks to return before you want to execute something? Hate having to add ugly boilerplate everywhere if you ever want to chain callbacks? Miss the return
statement? Think your code looks ugly because it has way too many levels of indentation?
Start using Deferreds and fix all these! Deferreds are a way of managing callbacks that is painless, elegant and powerful. Using deferreds makes your code cleaner, easier to understand and less error prone. And free ponies too!
Requirements
Intermediate level of Javascript knowledge would be sufficient.
Speaker bio
Yuvi Panda is a 21 year old open source geek who chases shiny new things way too often. He wrote major parts of the Wikipedia Android/iOS app (JS/Phonegap), and the upcoming Wiki Loves Monument app (also JS/PhoneGap). He was yearning for a threaded model in Javascript until he found Deferreds. Amongst his hobbies is screaming ‘USE DEFERREDS!’ at anyone claiming to use Javascript. He’s currently a student at KCG College of Technology.
{{ errorMsg }}