Asynchronous Programming (Why Observables execute late?)

When I started to work on Angular and started to use many functionalities on Angular; And It behaved differently than I think it should, it confused me a lot. The flow of functions, the order of processes was showing different than how I wrote the code and how I understood the code. After 2 days of banging my head on the keyboard, today I realized it was because of asynchronous programming.

Our CTO always tells us that “Programming is all about details.”

And Many Times, I found problems and confusion when I missed the details.

Let's try to understand Asynchronous Programming.

Usually, a simple block of code statements executes one by one. Every statement waits till the completion of the previous statement/instruction. But if the Instructions are not dependent on each other there is no need of waiting. They can execute simultaneously. 

The way of coding, simultaneously executable instructions are called Asynchronous Programming.

And in Angular you will find Observables, Subject, BehaviourSubject, Promises that help in Asynchronous Programming.

So, if you are using These Data types or functions in your project they will execute simultaneously.

You can still maintain the order by async and await. I will write about that next.

Thank you, hope this is helpful.


References :,calling%20a%20provided%20callback%20function.

Add comment