Asynchronous Programming is another concept which is slowly being used in the desktop and web applications. Have you ever experienced a situation where a web application or a desktop application is slow to respond once you request for something? I bet many of us, might have faced this situation currently or in the past.
This might be because these applications might have not adopted the Asynchronous programming approach. Let’s take an example of an Application which does not follow the Asynchronous Programming approach.
Suppose, we have a desktop application which obtains it’s content from the web. And for some reason during some particular day, the internet server is down or it is too slow. Due to this, the whole application will stop functioning and we will not be able to use the other aspects of the application. So, just because one resource fails to execute properly, the whole application stops working. This is not a pleasant situation in case we want the users to continue using our applications.
With Asynchronous Programming, this situation can be handled quite effectively. We can simultaneously run other other parts of the application, in case some aspects stop functioning temporarily.
Let’s take another example. Microsoft Excel is a common application which runs in the Windows Platform and there are similar applications which run on other Operating Systems as well. Many of us have used it.
Now let’s say we have created a spreadsheet regarding Contact Names and Telephone Numbers. And then suppose we want to search the Name of a person. Sometimes even though you are sure the Name is present, it would return a prompt saying that the Name is not found. In this case the search feature of Excel is currently not working. But, we would still be able to add new rows or columns and continue working with our application.
C# has recently added a new technique for Asynchronous Programming, to make it easier to adopt this feature.They have added two new keywords Async and Await which in a sense saves time in making the application Asynchronous.