Op zondag 6 oktober 2019 17:10 schreef FlippingCoin het volgende:• Asynchronous code is required because of the blocking behavior of synchronous code, you don’t want programs to freeze listening for input or data.
• Asynchronous code introduces a time aspect, uncertainty of the completion of previous called functions.
• Callbacks also known as Continuations offer a solution for this time aspect, chaining callbacks or Continuation Passing introduces horizontal scaling known as callback hell.
• Event Emitters are another solution for dealing with asynchronous event-based architectures, event emitters face the same problems as regular callbacks.
• Making continuations first class citizens is done creating Promises, promises make code less complex by making the time aspect clear and preventing horizontal scaling.
• The drawback of promises is they don’t support data sources producing more than one value, lack retrying behavior and can’t be canceled.
• Promises and event emitters solve the same sort of problem in different ways, promises for single values and event emitter for repeating values.
• JavaScript functions have a function based scope introducing side effects on nesting functions.
• RxJS abstracts away latency and allowing to model using linear sequence of steps through which data can flow.
• RxJS follows the reactive and functional paradigms and is build upon patterns like the observer and iterator patterns.