Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage Research How Do You Handle Async APIs and Callback Hell?

How Do You Handle Async APIs and Callback Hell?


InfoQ's research widget has been deprecated and is no longer available.

While asynchronous APIs can bring advantages, they certainly complicate programming by forcing developers to manually string together sequential operations using callbacks, causing a phenomenon called "Callback Hell".

The increasing popularity of asynchronous APIs, partially due to the rise of JavaScript and Node.js, means that many developers are now faced with a prolonged stay in Callback Hell. As is usual, developers with enough of an itch will find a way to scratch it. In the case of Callback Hell, there's a rich supply of hacks, workarounds, and solutions.

InfoQ wants to know: how do you handle asynchronous APIs? How do you stay out of Callback Hell or how do you manage it?

Language features and related

These are solutions that are either straight up language features or are supported by language features (eg. macros, etc).

Extensions of the language runtime or bytecode


  • Reactive Extensions (Rx)
    An increasingly popular approach that started on .NET and has been ported to other platforms including Java and JavaScript. As an example, Netflix is behind the Java port RxJava; see Netflix' Ben Christensen interview on RxJava.
  • Promises or Futures
    Promises (and their namesakes) have been adopted by many (standard) libraries and make it easier to chain operations. 
  • Embedded DSL-style libraries
    Libraries that allow one to chain statements, often using Promises underneath, are particularly popular in JavaScript.


  • State machines
    Using libraries like ignite.js, Ragel, etc.
  • Just write callbacks!
    Is "Callback Hell" just bad developers complaining about their tools? Do you just grit your teeth and nest your callbacks rather spend weeks researching alternative solutions?
  • Synchronous APIs
    Do you avoid asynchronous APIs at all costs? 

Note: if we missed your favorite language, library or solution, please tell us about it in the comments.