Interesting Talks from Scala Days 2015

by
Tags: ,

I was able to attend Scala Days 2015 in San Francisco and see some excellent presentations on the Scala ecosystem. I’d like to highlight ones that were of particular interest to me.

Scala – where it came from, where it’s going

Martin Odersky’s keynote was interesting in a few ways. First, he laid out two core principles of the Scala language: that it be a scalable language, and that the type system is focused primarily on flexibility and less on safety. Scalability refers to the language enabling users (or library authors) to define the functionality that they need rather than attempt to bake it all into the language. With recent developments in Scala.js, Scala code can now run on the JavaScript platforms as well as the JVM. He believes that the two principles espoused above are a major reason that this is possible. One thing that caught my attention was the proposal to compile Scala source code to a new intermediate format called TASTY. Code expressed in TASTY could then be linked and packaged for JavaScript, the JVM, or other platforms. Additional details preserved in the TASTY representation would allow tooling (debuggers, profilers, code analyzers) to produce better results than they can when looking at JVM classfiles. Using the TASTY format should also help solve the binary compatibility issue while also allowing bugs to be fixed in the compiler. It will be interesting to see if this works as promised.

Essential Scala: Six Core Principles for Learning Scala

Noel Walsh argues that Scala has a reputation as a complex language, but that it doesn’t need to be complicated. There are six core topics he believes are essential for learning Scala, but focused on three of them: Algebraic Data Types (ADT), Structural Recursion, and Sequencing Computations. ADTs are the combination of case classes and traits that allows us to model data as logical ands and logical ors. Structural recursion refers to the transformation of ADTs, and can be implemented with pattern matching or polymorphism. Sequencing computations refers to transforming values via functional programming, primarily relying on fold, map and flatMap. Noel asserts that these three patterns represent 90% of Scala code.

Akka in Production: Why and How

Evan Chan gave a presentation full of practical tips for building a production system that uses Akka. He found that in production that the Actor model was easier to understand than a Futures-based model, but that a simpler linear data flow through actors is easier to understand than a more complex arrangement. One issue with Akka applications is that stack traces are often useless. His solution is to stack a trait on an actor that sends message identity information to a collector along with identities of the current actor and the sending actor for later analysis.

Easy Scalability with Akka

Michael Nash presented the results of a comparison test where the same Akka/HTTP application was load tested using a CRUD-style backend and a CQRS/ES backend. They found that the CQRS/ES backend could handle substantially higher load with a more consistent response time without increasing complexity of the application code. However, they also found that tuning was far more important to the CQRS/ES backend than the CRUD backend, suggesting that it may be easy to miss out on the performance benefits.

How is Scala Made

Grzegorz Kossakowski discussed measures that the Scala team is taking to improve their ability to add new features to the language while not sacrificing stability. Tools and automation are essential to minimize the time to get feedback on a proposed change to the language. One aspect of this is automating pull request validation with Jenkins. Another aspect is a project called Dbuild, which is a build performed every night with 80+ community projects. This build allows the Scala team to find subtle bugs much quicker than they would without automation. Finally, he presented statistics indicating that the community outside of EPFL and Typesafe are more involved in Scala 2.11 than they were in 2.10, as measured by commits and number of committers.

Grok: an optimistic mini-library for efficient and safe parsing

Rex Kerr presented his solution for performing data validation that allows him to focus on transformation rather than handling errors, but still captures errors that occur at runtime and provides good performance when processing large datasets. One essential piece of this solution is replacing exception throwing with stack-less exceptions using the key pattern. The key pattern requires the caller to handle possible errors while avoiding the performance penalty of throwing exceptions.

Akka HTTP

Roland Kuhn gave an update on the latest in Akka HTTP, gave a tutorial on Akka Streams, and demonstrated a scenario where backpressure in Akka HTTP allows the rate of a file upload to be regulated. Much of the content in this presentation is in the live demos, however, so watch for the recording to become available.

Why Scala.js

Besides making a splash in Martin’s keynote, Scala.js was also the star of Li Hayoi’s presentation. It may be more obvious why you would care about this if you’re developing a web application, but he also suggests that you should care because Scala.js makes it easier to distribute Scala code to a wider audience. And if you are developing a web application, he gives some examples illustrating why coding in Scala is better than coding in JavaScript.

A Skeptic’s Look at scalaz’ “Gateway Drugs”

Brendan McAdams gives a very practical introduction to disjunction and validation in scalaz along with examples of how they overcome limitations in Either and Option.