Asynchronous Programming and Scala
Feb. 25th, 2017 10:47 amFor the relatively serious programmers, I commend the article Asynchronous Programming and Scala. It's somewhat dense stuff, and as written is entirely in Scala, but the principles are pretty generic. It's all about how to think about asynchronous programming, and makes some important high points:
- Asynchrony is not the same thing as Parallelism, although they are closely related.
- Callbacks are a wretched way to deal with async, since they don't really compose. (I have learned this one through much pain.)
- Futures and Promises are less wretched, but still problematic.
- If you really want to do this stuff right, proper functional-programming techniques rock.
Of course, this is largely a rationale and advertisement for the Monix Library, which is a more or less state of the art library for "doing it right" -- but it's a pretty compelling rationale.
None of this is easy: he's summarizing stuff that's taken me four years to really internalize. (One of my medium-term but relatively challenging goals is to rewrite the pipeline for the QL language inside Querki from being Future-centric to Monix-centric: the result would be vastly more efficient and reliable.)
But it's important material, especially if you're designing systems. I encourage you to read and absorb it. Feel free to ask me "what the heck is that bit talking about?" questions, or even questions about the syntax and functions in the examples -- I always enjoy burbling about programming in general and Scala in particular...