Understanding the differences between Asynchronous and Synchronous models in programming is crucial. Synchronous, also referred to as a blocking-model or single-thread operation, handles things in order so when a task is handled other tasks have to wait their turn. On the other hand, Asynchronous, non-blocking-model or multi-thread operation, handles thing independently allowing multiple tasks are done at the same.
Even though it seems that, most of the time, the Asynchronous model has the advantages over its counterpart, that is not always the case because choosing which one to use depends on the task at hand. For example, when a task depends on the result of another task you cannot use Asynchronous model as it will throw an error.
Synchronous
- Tasks are taking place in order
- When one task is running the others have wait
- simpler code
Asynchronous
- Tasks run independently
- Multiple tasks can run at the same time
- Fast loading time and improved UX (User Experience)
References
'Web Development Tips' 카테고리의 다른 글
Logistics Delivery Status (Lotte, Post Office) (0) | 2023.12.19 |
---|---|
Adding Open With a Program (0) | 2023.09.01 |
Deprecated (12) | 2023.07.12 |
Environment Variables (2) | 2023.05.31 |
Payment Service - Stripe (1) | 2023.05.25 |