Skip to main content

Synchronous Vs Asynchronous

Synchronous:


  • Blocking, single-threaded
  • only one operation can progress at a time
  • code is executed sequentially from top to bottom, blocking on long running tasks such as network req. and disk I/O.
  • result wait and execute sequentially.
  • Highly readable code
  • easy to implement logic
  • cost effective, convenient
  • strictly technology based, demandes high speed internet, internet connection, local time barriers, requires careful planning.
  • eg: php, java, python

Asynchronous

  • Normal js which has some ajax calls which dynamically load data from server without affecting the current flow of execution.
  • no wait for result and execute sequentially.
  • using asynchronous js (such as callbacks, promises and async/wait), you can perform long network req. without blocking the main thread.
  • fast execution
  • eg: reactive programming
  • hard to implement logic
  • eg: javascript, typescript
  • no result wait so hard to handle result
  • asynchronous result handle (use callback, promise, observable)
  • async/await treat js async function as a sync function.

Comments

Popular posts from this blog

Heroku

Install the Heroku CLI Download and install the  Heroku CLI . If you haven't already, log in to your Heroku account and follow the prompts to create a new SSH public key. $ heroku login Create a new Git repository Initialize a git repository in a new or existing directory $ cd my-project/ $ git init $ heroku git:remote -a mernstackblogappdemo Deploy your application Commit your code to the repository and deploy it to Heroku using Git. $ git add . $ git commit -am "make it better" $ git push heroku master Existing Git repository For existing repositories, simply add the  heroku  remote $ heroku git:remote -a mernstackblogappdemo Source: https://devcenter.heroku.com/articles/heroku-cli

VS Code

1. cmd+shift+p (search feature in vs code) 2. run command (code .) (it will be installed and run code from terminal) # VS CODE - code, debug, extension, extension icon - jshint - prettier-code formatter - beautify - vscode - icons - ESLint - TSLint

MERN

The MERN stack is a popular stack of technologies for building a modern single-page application. The MERN stack consists of the following technologies: MongoDB : A document-based open source database. Express : A web application framework for Node.js. React : A JavaScript front-end library for building user interfaces. Node.js : JavaScript run-time environment that executes JavaScript code outside of a browser (such as a server). It is also common to use  Mongoose , which is a simple, schema-based solution to model application data.