Day 53: Asynchronous

Inseo Park·2021년 9월 27일
0

Path to Data Scientist

목록 보기
51/58
post-thumbnail

1. TIL (Today I Learned)

Asynchronous

Understand Asynchronous

Imagine writing in line to order coffee at a coffee shop. Due to the circumstances of the coffee shop, it is said that the hacker Park, who is standing in line, cannot even place an order until Kim Coding, who cam first who ordered coffee. receives the coffee he ordered. This is what we call 'blocking.' Until one task is finished, it "blocks" the next task.
Hacker Park can order coffee only after the coffee ordered by Kim Coding comes out. The time when Kim Coding's coffee order is completed and Hacker Park's coffee order start time are the same. A situation in which the start time and the completion point are the same is "synchronous." It is said:
For efficient coffee shop operation, let's change the coffee shop ordering process as follows.

  • Coffee orders are not blocked, and you can take orders at any time.
  • Coffee is served as soon as the coffee is ready.

Kim Coding's order completion time and Park Hacker's order start time do not need to be the same.
Even the developers who made Node.js thought the above alternative was reasonable. So we develop Node.js as a non-blocking and asynchronous runtime.
The concept of asynchronous execution in JavaScript is particularly useful in web development. In particular, the operations below must be run asynchronously to be efficient. Gotta get used to it, right?

  • Tasks such as background execution, loading windows, etc.
  • Sending a request from the Internet to a server and waiting for response.
  • Loading large files.

Introduction

In this unit, you will learn asynchronous flow, one of the great advantages of JavaScript. Asynchronous flow can be implemented using one of callback, promise, and async/await syntax. In this unit, we review the previously learned callback, and additionally learn promises and async/await.
You will also learn about the fs module, which allows you to read and save files with Node.js. Learn basic file reading and writing, and practice how to apply callbacks, promises, and async/await, which you will learn in the future.

Before You Learn

By reading the example above, you can roughly understand the concepts below.

  • blocking/non-blocking
  • synchronous/asynchronous
  • Know how to pass a callback function.
  • Know method chaining ( how to use Array's map, filter, etc.)

Achievement Goals

  • It is understandble in which cases nested callbacks occur.
  • You can understand the disadvantages of nested callbacks and the advantages of promises.
  • You can understand the Promise usage pattern
    -You can understand the meaning of resolve and reject, and the relationship between then and catch.
    -You can understand how to pass arguments in Promise.
    -Three states of Promises can be understood.
    -You can understand how to use Promise.all.
    -You can understand the async/await keywords and understand how they work.
    -You can understand how to use the fs module of Node.js

2. 3 Things to be Thankful For

  1. Thankful for giving me a chance to be interviewed for a potential job offer.
  2. Thankful for God being with me on such unsure times.
  3. Thankful for being able to come back to basic and hustle.

3. Ideas and Things to Think About

  1. I had a long break because I actually burned out of pace and had some hard time thinking on what my future would become like. But the reason I came back is that all things are on God, and nothing I do can change His will. Therefore, I decided to do the things I can everyday without being lazy and just believe He will do the rest.
profile
my journey to become a data scientist.

0개의 댓글