e.near Tech Blog

LX Scala

On April 9, Scala developers from Portugal, Spain and the UK gathered in Lisbon for LX Scala to discuss Scala’s present and future trends. These are my notes from the talks…

Noel Welsh - Programming: For the People, By the People

The first talk was Noel’s keynote with some inspiring quotes on being a Scala developer right now like “It’s a great time to be a Scala developer” and “We’re on the right side on history”.

Then Noel explained some issues he experienced when teaching Scala. Stating that human beings have “loss aversion”, likewise programmers transitioning to FP from OO have aversion on abandoning all those nice patterns from GoF (which Noel says “made sense at the time”). Separating concepts from code, by teaching the concepts using diagrams instead of code proved to be good approach.

He concluded that the “age of exploring (in Scala) is ending” and the community should agree on a Scala “way of doing things”

Nick Stanchenko - Unzipping immutability

Nick’s talk started by asking how immutable data structures can be fast since one is always copying things around. Using a very nice library called reftree which he wrote for visualizing immutable data structures, it is easy to understand how some operations on Lists, Queues, Vectors, etc are implemented in why they are very efficient.

Then Nick introduced the motivation for using a lens library in Scala when doing modifications to immutable data structures, where one has to nest multiple copy calls. The examples used monocle but he also mentioned quicklens to remove boilerplate. Again the usage of reftree made the explanation very clear. For recursive data structures he presented the Zipper concept and a Scala library that implements it

Noel Markham - Practical Scalacheck

Noel talk was about ScalaCheck, which he called “A bridge between types and values” in the sense that ScalaCheck will generate the values for your richly typed API. The presentation was a very good user guide on using ScalaCheck, but also included very good advices on using the library, like how to avoid reimplementing your business logic again in your ScalaCheck tests, the usage of successful and failed generators, and increasing the number of generated tests in your CI server. He also mentioned the new Cogen typeclass introduced in ScalaCheck 1.13 that allows the creation of better Generators for functions.

Renato Cavalcanti - Fun.CQRS: a CQRS/ES library for Scala built on top of Akka.

Renato presented a CQRS and EventSourcing library for Scala called Fun.CQRS. He started introducing the CQRS (hint: no whats in the tweet bellow) and ES concepts and then presenting a lottery application where the state was persisted between runs in a EventSourcing journal. This library differs from Akka-persistence because it is Akka agnostic and supports different backends, although currently it only supports an Akka backend and an in-memory backend for testing purposes (plans exists for supporting other backends). The library is still in its early stages, but it is currently used in production.

Michael Barton - Build your eventually consistent system from scratch

Michael, a self titled “Distributed Systems Amateur”, presented how they built their distributed system from scratch using Akka technologies like Akka-cluster, Akka-cluster sharding and Akka-persistence. He also explored the CRDT’s from Akka-distributed-data and how it didn’t fit their requirements due to the constant propagation of state. Michael referenced some other projects to watch like gearpump which recently joined Apache Foundation incubation and orleans

Alexy Khrabrov - Functional Data with Scala

Alexy talked about Scala and functional programming as Killer App for Data, stating that Scala is currently the best language to do data pipelines. He talked about several interesting projects like abstract_data, FiloDB, framian, algebird and other twitter OSS projects, and deeplearning4j. He mentioned the SMACK stack for big data pipelines, which stands for Scala/Spark, Mesos, Akka, Cassandra and Kafka, and the noETL movement. Finally he played an inspirational video on how Scala is contributing to advances in cancer research.

Johann Egger - Scala code analysis at Codacy: Before and after scala.meta

Johann described Codacy’s Scala static analysis engine evolution. First they attempted an universal AST (to rule them all?), that would allow Codacy to write generic patterns for all the languages, but in the end the universal AST was not expressive enough because it was too simple and was losing information specific to the language. The second version used scala.reflect to parse the source code to the scala AST, the AST was converted to Json, and the patterns written in Javascript would be executed in node.js or in the browser. However the Json AST and the Javascript patterns were too complex. Enter scala.meta, where patterns are written in Scala and matching code is much simpler by pattern matching quasiquotes.

Patrick Di Loreto - Going Reactive

Patrick described William Hill’s new reactive architecture that uses lambda architecture and SMACK stack, which they named omnia platform. The presentation shared many good advices for building an highly scalable platform.

Danielle Ashley - Notes from inappropriate projects

Danielle shared with the audience some personnel projects that she implemented in Scala, and referenced them as inappropriate because choosing Scala to implement an mp3 decoder or a Gameboy emulator isn’t a first choice. She shared some tips on the balance between functional purity and runtime performance, like implementing some mutable computation but hide it in a functional API, or avoid object instantiation.

João Cavalheiro - From no services to MicroServices

João guided us in a journey of transforming a FinTech application from a monolith to a micro-services architecture. He explained the advantages of using Scala in the FinTech industry, due to its complex business models and the required quality of service like high availability, and the easiness to move a team with Java knowledge to a Scala team and the best ways to do that. He explained the migration process and the technologies used to create the first micro-services and the embrace of eventual consistency.

Eric Torreborre - The Eff monad, one monad to rule them all

The last talk was a Keynote from Eric (author of Specs2 test library) about his work on implementing the Eff monad in Scala. He started with the usage of Monad transformers to compose monads, but highlighted its drawbacks, in this way presented the motivating example. The Eff Monad is based on Oleg Kiselyov paper Freer Monads, More Extensible Effects. The Eff library is implemented for both cats and scalaz library and provides effects for Reader, Writer, Option, State and other monads.