I was recently was on a project–not in Scala!–which used async/await for asynchronous computations. Async/await is ““syntactic feature of many programming languages that allows an asynchronous, non-blocking function to be structured in a way similar to an ordinary synchronous function.”” (Wikipedia) Using it was very confusing to me as I had first learned async programming with Futures. I have to use some magic keywords when dealing with async code? Why would anyone want to do this, instead of using a monad like Future? (Monad just means you can flatMap() it or use it in a for-comprehension.)
It took me a couple of weeks to become comfortable, but I started to understand the rationale of async/await and would like to share it with you, so you don’t have to be as confused as I was–or at least for as long. You’ll learn:
the underlying problem both solutions attempt to solve;
how async/await works; and
why async/await is a compelling technique.
Inner Product LLC
Adam Rosien is a Principal at Inner Product, focused on building systems using functional programming.
He previously helped various startups in many domains develop back-end systems and implement continuous deployment practices,
and also spent five years as a developer at Xerox PARC.
Join our conference
Subscribe and follow @ScalaDays on Twitter for the latest conference updates.