Cancel All My Appointments!

Cancel All My Appointments!

(Video: https://www.youtube.com/watch?v=VDaKLQE03ss)

The most complicated state in an application is time. Like cooking a bag of microwave popcorn, modern web applications desperately try to keep up with their state through an orchestrated chaos of asynchronous operations popping off in indeterminate cadence. No question, coordinating all this concurrency is hard.

But there's a pitfall at the heart of asynchrony that stays mostly unaddressed.

When an operation doesn't finish right away, synchronously, it's possible the operation may never finish. Or, it may be destined to finish eventually, but a second operation may be raised which means we no longer care about the first. Whatever the case, we need to be able to cancel it. This critical check ultimately protects users from the vagaries of unpredictable systems.

Cancellation should be core to our async programming; no asynchrony should run without it. Too often, such handling is just a corner case exception. Without a cancellation strategy, your applications are incomplete at best.

We'll discuss use-cases for async cancellation and various approaches to managing them.

35761e3936deba2f8189c2d20982c771?s=128

Kyle Simpson

December 07, 2018
Tweet

Transcript

  1. 5.

    Cancel Abort Call-Off Abandon Stop Kill Revoke Quit Pause? Terminate

    Undo? Final } { Recover
 Rollback Event? State @getify
  2. 6.

    Events are unexpected. States are expected. Cancellation should never be

    an unexpected exception. Cancellation should be a predictable state. @getify
  3. 14.
  4. 16.
  5. 18.
  6. 22.
  7. 27.

    I FIGHT FOR THE
 USERS . . . . .

    . AND THEY WANT CANCELLATION! @getify
  8. 28.
  9. 29.
  10. 30.
  11. 31.
  12. 32.
  13. 33.
  14. 34.
  15. 47.
  16. 48.
  17. 53.
  18. 56.
  19. 62.
  20. 63.
  21. 67.
  22. 70.
  23. 73.
  24. 74.
  25. 76.
  26. 80.
  27. 81.
  28. 83.

    If it's async, it's gonna get
 canceled finally { ...whether

    you handle that state or not. cancellation shouldn't be an unexpected exception. @getify
  29. 84.

    unexpected cancellation states feed uncertainty. } uncertainty spreads unnecessary complexity.

    complexity cancels out software quality and momentum. @getify