October 30, 2017

ELI5: Synchronous vs Asynchronous programming

Synchronous:  When you go to a restaurant and there's a HUGE line and a LONG wait but you have to stay in the waiting room until your table is ready.  Basically you're stuck in the restaurant for 30-45 minutes and can't go anywhere or do anything and your life screeches to a grinding halt.
(programming example: your UI freezes on a PUT until the call returns)

Asynchronous:  When you go to a restaurant and there's a HUGE line and a LONG wait but you can just put your phone number down and they'll call you when your table is almost ready.  You can go and get coffee or walk in the park or go to the bookstore and your life goes on as usual.  Sometimes you can even check on the status of your wait from your phone and see how many people are ahead of you.  And when your table is ready you can go to the restaurant and eat.
(programming example: you issue a PUT from the UI but you can still do stuff in the UI, and in the background the code continually calls for updates on the PUT until it successfully completes)

From my experience, restaurants in Seattle and Columbus are synchronous and restaurants in Portland are asynchronous.