Asynchronous programming has recently become a no less developed direction than classical parallel programming, and in the JavaScript world, both in browsers and Node.js, understanding of its techniques has taken one of the central places in shaping the developers' worldview. I offer you a holistic and most comprehensive course with an explanation of all the common methods of asynchronous programming, adapters between them and auxiliary openings. Now it consists of 23 lectures, 3 reports and 28 repositories with many examples of code on github. Only about 17 hours of video: link to the playlist .
The diagram (above) shows the connections between different ways of working with asynchrony. Colored blocks are related to asynchronous programming, and b / w shows methods of parallel programming (semaphores, mutexes, barriers, etc.) and petri nets, which, like asynchronous programming and model of actors, are different approaches to the implementation of parallel computing (they given on the scheme only to more accurately determine the place of asynchronous programming). The model of actors is associated with asynchronous programming because the implementation of actors without multithreading also has a right to exist and serves to structure the asynchronous code. The dotted lines of the event and the competitive queue are associated with callbacks because these abstractions are based on callbacks, but still form qualitatively new approaches.
1. Asynchronous programming (overview)
2. Timers, Timeouts, and EventEmitter
3. Asynchronous programming on callback
4. Non-blocking asynchronous iteration
5. Asynchrony with async.js library
6. Asynchrony on promis
7. Asynchronous Functions and Error Handling
8. Asynchronous adapters: promisify, callbackify, asyncify
9. Asynchronous data collectors
10. Raw errors in promises
11. The problem of asynchronous infrastructure
12. Generators and asynchronous generators
13. Iterators and asynchronous iterators
14. Cancel asynchronous operations
15. Asynchronous composition of functions
16. Thenable and lightweight await
17. Competitive asynchronous queue
18. Pattern open designer (Revealing Constructor)
19. Future: Asynchrony on stateless futures
20. Deferred: Asynchrony on state dipers
21. Actor Model
22. Pattern Observer (Observer + Observable)
23. Asynchrony on RxJS and event streams
Under each video there are links to repositories with code examples that are versed in the video. I tried to show that it is not necessary to reduce everything to a single abstraction of asynchrony. There is no universal approach to asynchrony, and for each case, you can choose the methods that allow you to write code more naturally for this particular task. Of course, this course will be supplemented and I ask everyone to suggest new topics and contribute to code samples. The main objective of the course is to show how to build abstractions of asynchrony from the inside, and not just to teach them to use. Almost all abstractions are not taken from libraries, but are given in the simplest way to implement them and their work is disassembled step by step.
Source: https://habr.com/ru/post/452974/
All Articles