Structural Types is a neat feature of Scala that not many developers know or use. This article will provide a brief introduction on what they are and how to use them. What are Structural Types? Types can be really powerful in Scala: they can define classes, abstract classes, objects, traits, functions...and a lot more! What… Continue reading Static Duck Typing in Scala
Author: Daniela Sfregola
Performance Comparison between immutable Seq, List, Vector
I have recently attended the Advanced Scala Training Course by TypeSafe during the Scala Days Conference in Amsterdam. During the course we discussed a lot on how to write cleaner and more performant Scala code: one of the parameters that can greatly influence your performance is the type of collections used. Which type of collection… Continue reading Performance Comparison between immutable Seq, List, Vector
Enrich My Library – Extension Methods
(At the time of writing of this article, this Scala technique was called "Pimp My Library", which was also reflected in its title. This term is now obsolete and discouraged and has been replaced with a much clearer and less offensive term: "Extension Methods". This article has been edited to reflect this). Methods are an… Continue reading Enrich My Library – Extension Methods
Loading Configurations in Scala
The separation of configuration from code is a good practice that makes our system customisable as we can load different configurations according to the environment we are running it in. In this article we will describe different approaches to load configurations in Scala and how they can be combined together: loading configurations from a file,… Continue reading Loading Configurations in Scala
Scala Italy 2015 Highlights
A few days ago I had the opportunity of attending and speaking at Scala Italy 2015, hosted in Milan. Scala Italy is the only Italian Conference on Scala: they aim to spread the use of Scala in the Italian Developers Community and to contribute to the Scala Community. The conference was hosted by UniCredit and… Continue reading Scala Italy 2015 Highlights
Akka Dead Letters Channel
Akka doesn't guarantee the delivery of a message. What happens when a message cannot be delivered? In this article we will describe how the Dead Letters Channel works and how it can be used to spot issues in our system. How it works In a previous article we have described the use of Event Streams… Continue reading Akka Dead Letters Channel
Peer-to-Many Communication in Akka
The most common communication channel in Akka is Peer-to-Peer, where an individual actor sends a message directly to another individual actor actor. However, sometimes this is not enough as we may need a Peer-to-Many type of communication, where an individual actor sends a message to a group of actors. This is particularly useful when you… Continue reading Peer-to-Many Communication in Akka
Pure Functions
One of the key principles of functional programming is writing pure functions. What is a pure functions? Why do we care? Why everyone is talking about it? This article will try and answer these questions. Purity and Referentially Transparent Expressions A pure function is composed only by referentially transparent expressions. An expression is referentially transparent… Continue reading Pure Functions
How to Compose Futures
Futures are a powerful tool that has been developed by the Akka team and then adopted as a standard Scala library from version 2.10. A Future is a placeholder for a value that will be available in the future: thanks to it, it is possible to run operations in parallel and to worry about what… Continue reading How to Compose Futures
How to Integrate ReactiveMongo in your Akka Spray Application
Scalability can be challenging when database access is needed: the common approach is to block the thread until a response is received. ReactiveMongo is a MongoDB Scala Driver that provides fully non-blocking asynchronous I/O operation that increases the scalability of your system. In a previous post we have seen how to build a REST Api… Continue reading How to Integrate ReactiveMongo in your Akka Spray Application