Application Development: Asynchronous JavaScript code by Promises

Both front-end JavaScript code and runned on server side node.js applications are designed not just a long-run set of instructions, but rather a set of functions, which are runned by the engine as handlers of appropriate events. E.g., user clicks the button, server received request from the client, page loaded, server started started. Any JavaScript engine is just very sophisticated implementation of Event Loop pattern. There is a lot of stuff written about V8 engine, which node.js based on. Such architecture has asynchronous nature by design. That’s why it’s very important to deal well with asynchronous Application Development for any professional JavaScript developer.

Callbacks and other approaches

The simplest native way to deal with asynchronous code is to use callbacks. It may be ok in case of small application or use case. On the other hand, in real life Application Development, Iflexion company have complicated huge solutions splitted into many modules and layers. To use pure callbacks in this situation is antipattern.

Read more