Talk: The New Async Design Patterns

Async involves some new concepts. They're not difficult; just unfamiliar. Over the past year I've been watching how people use it. This talk distils out the three top async patterns and anti-patterns.

  1. Async void is for top-level event-handlers only, and event-like things. Don't use it elsewhere in your code.
  2. You can wrap events up in Task-returning APIs and await them. This can dramatically simplify code.
  3. It's crucial to distinguish CPU-bound work (should be done on threadpool) from IO-bound work (which needn't).
If you understand the basic flow of control in an async method, then those three points all fall naturally into place.
 
 
 
 
 
 
 
PS. The first anti-pattern is "async void". People of course ask: "If it's so wrong, then why did you allow it?" That's a good question. I'll write a blog post solely on this question next week.