6 Mistakes to Avoid If You Work With Scala Futures

Vigneshwaran Raveendran
Geek Culture
Published in
6 min readFeb 17, 2021

--

Ignoring this post could be the 7th

Photo by krakenimages on Unsplash

Okay, I’ve already written a post about Scala Future before but that one was specific to one particular mistake. This one is a collection of several mistakes that you may make or come across when coding in or reviewing Scala Future code.

A bit about me — I work in a big travel company as a Scala dev for the past 4 years and I have seen me and my every new-joiner colleagues going through this beginner phase making such mistakes. I ran some workshops about this within the company and now getting this out for the wide world.

So here it goes.. with George and Martha (the same imaginary folks from the SICP book who are now learning Scala.)

Mistake 1 — Using Await with Futures (even in tests)

Using Await around Scala Future like this means George has yet to grok asynchronous programming.

Coming from the Java world, George is too used to imperative programming which means he needs to have his variables in his hand. So he schedules the Future, awaits it to get the result so he can make use of it. But then what is the point of using Future at all?

--

--

Responses (2)