Windows 8 app creators are getting more assistance from Microsoft via the company's official Windows 8 developers app blog. This week, the blog added a new entry which talks about how app makers can use asynchronous code to help create "fast and fluid Metro style apps."
As usual with the app developers blog, the newest article is highly technical and written mostly for programmers. However, Microsoft's Jason Olson does write in the beginning in more general terms about how app creators should try to make their Windows 8 apps responsive as possible for users.
How many times have you been using a Windows app that stops responding, and you are presented with a greyed version of the app and the spinning donut? Without fail, it always seems to come at the worst possible time. Worse yet, you might end up losing a lot of hard work when this happens.
Users expect apps to be responsive to all interactions. When they use their favorite news reading app, they want to add news feeds, read news articles, save news articles, etc. They should be able to do all of these things even when the app is retrieving the latest articles from the Internet.
Olson says that one of the reasons why an app might not be as responsive as it could be is because the app is synchronous. That basically means the app is waiting for some other process to finish and can't be interacted with until that process is complete. Examples of this kind of activity include the app trying to obtain data from the Internet.
When creating the APIs for the Windows Runtime (WinRT), Olsen states that they wanted a number of them to be asynchronous. He give an example of how this works via the analogy of giving someone your callback number:
You give the person the number to call you back, you hang up, and then you continue doing any other work you need to. When the person is ready to talk to you, they can call you back at the number you provided. This is the essence of how asynchrony works in WinRT.
The rest of the blog entry is written specifically for app developers and includes examples of code that Windows 8 makers can use to make their app asynchronous under WinRT. Olsen concludes the post by saying:
We want your customers to love your Windows 8 apps. We want those apps to start alive with activity, and remain alive with activity. And we want you to more easily create those apps. We want you to be able to easily connect to social websites, store data in the cloud, work with files on the hard disk, communicate with other gadgets and devices, etc., while providing your customers with a great user experience.