Scala Symposium: Promise of a Better Future

Promise of a Better Future

- Session presented by Rahul Goma Phulore and Pooja Akshantal, ThoughtWorks

Pooja and I have been working on a large scale Scala project at ThoughtWorks for more than a year now, and have been using Scala, Play, and a teensy bit of Akka successfully. We have been using future-based concurrency, which is what this talk was about.

Concurrency and parallelism are distinct ideas, often confused with each other. We illustrated how the two ideas are orthogonal, and asserted that concurrency is a great enabler of parallelism.

We then looked at what futures and promises are, and how they can help in achieving end-to-end non-blocking architecture. Now futures and promises aren’t exactly a new idea, and pretty much everyone who has some experience with Javascript or Java is familiar with them. This abstraction is typically dreaded for its callback-based APIs. We demonstrated how Scala, with its great support for functional programming and some advanced abstractions, improves in this respect. We used a running code example to illustrate our point. We began by introducing a callback based solution, and rewrote it with a number of abstractions which incrementally improve its interface. The abstractions were, viz., combinators, for-comprehensions, and Akka’s dataflow DSL (based on delimited continuations).

We also briefly talked about error recovery techniques, bulk operations, and some patterns that we discovered ourselves over past year and a half. Towards the end, we also went over some pitfalls and limitations of futures, and emphasized the fact that even though futures are awesome (which we hope to have convinced the audience of!), there are no silver bullets.


First Annual Pune Scala Symposium

We have uploaded the photos here. Follow us on @punescala or join "Pune Area Scala Enthusiasts" meetup group for updates.