Asynchronous Programming - Reading Assignment

  1. synchronicus functions (whatever they’re called) can only do one at a time while ansyncronimus (idk how to spell :frowning: ) can deal with multple
  2. It is when callback are in callbacks
  3. we can use node.js to solve callback hell and handle errors
1 Like
1. What is the difference between synchronous and asynchronous functions?
    - The difference is that synchronous code runs line by line and is blocking while asynchronous code allows for blocking code items to be put in a queue until that code execution is completed, such as a process or computation to complete or for data to be received.
2. What is callback hell?
    - Numerous nested function calls
3. Which technique can help us solve callback hell?
    - Promises is one approach but they can be dealt with in the form of third party libraries or even different variations of the javascript syntax and/or web API
1 Like
  1. Synchronous functions block the program further execution until something is done. Asynchronous functions do not block the program and wait while the program thread does another task.
  2. Callback Hell is a situation where several functions are being performed in nested form.
  3. Promise is used to solve the callback hell situation. jQuerry, Angular JS comes with a promise library that can help you solve callback hell situation.
1 Like
  1. What is the difference between synchronous and asynchronous functions?
    synchronous can be blocking into a program not to respond to other event while the first code is still running.
    asynchronous functions will continuously wait when the program is executing to its completion.

  2. What is callback hell? is when multiple/complex functions are produced to a level reading and maintaining a program becomes difficult.

  3. Which technique can help us solve callback hell?
    Promises can solve callback hell.jQuery ships with a simple built-in promise library that enables us to chain callbacks and deal with errors.

1 Like
  1. What is the difference between synchronous and asynchronous functions?
    Whereas a synchronous task will run at any one time until its completion, an asynchronous task can be initiated and then put aside until a later date while our
    program is performing the next task on his to-do list.

  2. What is callback hell?
    Complex operations with several levels and sub-levels of arguments.

  3. Which technique can help us solve callback hell?
    A common pattern to deal with excessive callbacks is to use promises.

1 Like
  1. Synchronous functions are single-threaded and take up all of the event handlers attention, as where asynchronous functions can be initiated and then put aside while the event handler starts on a different task.
  2. Callback hell is where you have many nested functions and have to do a lot of callback functions even to perform simple tasks, which makes the code harder to write.
  3. A technique to help solve callback hell is using something called promises, like the jQuery promise library that lets us chain callbacks and deal with errors.
1 Like
  1. Synchronous it is when JS can execute only one function at a time, while asynchronous it is when a multiple tasks are executed at the same time.
  2. It is when several functions are being performed in nested form.
  3. Promises technique.
1 Like

1.Synchronous functions run one code at a time while asynchronous functions can run while waiting on a prior code to complete.

2.Callback hell occurs when you have several layers of completed code coming back at once.

3.Promises will ship all callbacks to a library that chains callbacks and it deals with errors.

1 Like
  1. What is the difference between synchronous and asynchronous functions?
    Synchronous function is executed in sequence – each statement waits for the previous statement to finish before executing. Asynchronous function doesn’t have to wait – your program can continue to run, reducing waiting time for the user.

  2. What is callback hell?
    Callback hell is a problem caused by coding with complex nested callbacks. Here, each and every callback takes an argument that is a result of the previous callbacks. In this manner, The code structure looks like a pyramid, making it difficult to read and maintain. Also, if there is an error in one function, then all other functions get affected.

  3. Which technique can help us solve callback hell?
    We solve callback hell using Javascript promises.

1 Like

Questions:
. Synchronous functions are prioritized by Javes, while asynchronous functions will only be executed once the current task has been completed.
. When multiple functions are needed in order to carry on with the following task.
. Promises are used to deal with the issue.

1 Like

What is the difference between synchronous and asynchronous functions?

-synchronous functions can perform one task at a time, and completes the task in a particular order, where asynchronous tasks can run many tasks at the same time and do not always have to wait for other tasks to complete before continueing.

What is callback hell?

-this is when code perform servarel functions in a nested from and they end up waiting for each other to complete

Which technique can help us solve callback hell?

-You can use promises, which enables us to chain callbacks and deal with errors.

1 Like
  1. What is the difference between synchronous and asynchronous functions?
    Synchronous functions run one at a time from top to bottom, left to right.
    Asynchronous functions can be initiated and then put aside until we receive the external data to be able to continue the function. While the function is put aside we can continue with the next functions while we wait.
  2. What is callback hell?
    Callback Hell is when we have complex operations with lots of callback handlers in a function.
  3. Which technique can help us solve callback hell?

To solve callback hell we can use promises. jQuery ships with a
simple built-in promise library that enables us to chain callbacks and deal with errors.

In Node.js, we can use a different approach. By extending the runtime, we can abstract away the
asynchronicity and write code that looks sychronous.
this is what Meteor does behind the scenes using the Fibers package.

1 Like
  1. Synchronous functions occupy JavaScript in the browser continuously until functions are completed, while asynchronous functions can be put aside and be completed at a later time.

  2. As multiple asynchronous functions are to be executed, that create many levels and sub-levels are created, and thus lead to excessive amount of callbacks.

  3. Using promises, which comes with JQuery, that can enable us to chain the callbacks and deal with any errors.

1 Like
  1. Synchronous functions block code execution until it is complete while asynchronous functions allow other code to be executed before it is completed.
  2. Callback hell is when event handlers are nested in order to make the code asynchronous, but increases code complexity as the nesting could go on for a quite a while.
  3. Promises can be used to write asynchronous code in a synchronous format.
1 Like
  1. Synchronous functions are taking the full attention of Javascript and prevent other parts of the code to be executed. Asynchronous functions can be initiated and run on the backround till the task is finished.
  2. A callback hell is when there are more levels of nested functions running asynchronously while waiting to be finished that make the code messy to read.
  3. You can use promises to fix this callback hell.
1 Like
  1. Synchronous function do the task one by one. Asynchronous can do multiple task at once.
  2. Call back hell means severals functions are being performed in nested form.
  3. Promises
1 Like
  1. Synchronous is a function that needs to be dealt with immediately, since Javascript handles one operation at a time synchronous functions can cause a browser to lockup. Asynchronous functions can be initiated but set aside until a later time when they are completed, allowing other functions to run.
  2. Callback hell occurs when a programmer creates complex code that produce many levels and sub level operations. All of these functions need to be called creating a problem.
  3. jQuery solves callback hell by using promises in their library which allow us to chain callbacks and deal with errors. Node.js extends runtime and writes code that appears synchronous. Meteor uses a fiber package that makes code simpler by writing code in a synchronous style.
1 Like
  1. Synchronous functions block the program execution until finished while asynchronous functions allow more than one section of code in the function to run.
  2. Callback hell refers to when asynchronous functions have callbacks within callbacks to the degree they are complex and disorganized.
  3. The technique we can use to solve callback hell is the use of promises allowing us to chain callbacks
1 Like
  1. Asynchronous tasks can be initiated and then put aside, thereby not clogging the program, whereby synchronous tasks take up the full attention of the program, and it will run until complete.
  2. Callback hell is a program that has many complex nested operations within levels and sub levels which requires many calls to the server.
  3. Callback hell can be handled with the use of promises in jQuery to chain callbacks and handle errors, or using node.js or Fibers to extend the run-time with synchronous control flow.
1 Like
  1. Ansynchronous functions execute regardless of the completion of other functions while Synchronous functions execute one at a time and stop all other operations until they are completed.

  2. Callback hell refers to when there are several functions being preformed in nested form, which is undesirable and makes for more difficult situations.

  3. Using promises may solve callback hell

1 Like