Home » JVM Languages » Scala

Scala

Integration testing with Gradle

Unit testing works automatically using Gradle, but if you would like to have a separate set of integration tests you need to do a small exercise. Actually they don’t have to be integration tests at all. This guide shows you how to configure Gradle to use any kind of tests and run them independently from others. I will use Scala ...

Read More »

Listen to notifications from Postgresql with Scala

In the past I’ve written a couple of articles (Building a REST service in Scala with Akka HTTP, Akka Streams and reactive mongo and ReactiveMongo with Akka, Scala and websockets) which used MongoDB to push updates directly from the database to a Scala application. This is a very nice feature if you just want to subscribe your application to a ...

Read More »

Scala typeclass explained: Implement a String.read function

In this short article I’d like to explain how you can use the typeclass pattern in Scala to implement adhoc polymorphism. We won’t go into too much theoretical details in this article, the main thing I want to show you is how easy is really is to create a flexible extensible model without tying your domain model to specific implementation ...

Read More »

Dependency injection: syntax sugar over function composition

Quoting Dependency Injection Demystified: “Dependency Injection” is a 25-dollar term for a 5-cent concept. *James Shore, 22 Mar, 2006 Dependency injection, as much as it is important when writing testable, composable and well-structured applications, means nothing more than having objects with constructors. In this article I want to show you how dependency injection is basically just a syntax sugar that ...

Read More »

Refactoring with Kleisli Composition

For quite awhile we have been maintaining an application that processes XML and JSON data. Usually the maintenance consists of fixing defects and adding minor features, but sometimes it requires refactoring old code. Consider, for example, a function that extracts an XML node by path: import scala.xml.{Node => XmlNode} def getByPath(path: List[String], root: XmlNode): Option[XmlNode] = path match { case ...

Read More »

Divided We Win: an event sourcing / CQRS prospective on write and read models separation. Commands and Events.

In today’s post we are going to unveil some very interesting (in my opinion) architecture styles: event sourcing and command query responsibility segregation (CQRS). Essentially, in both of them events are in the heart of the system design and reflect any changes of the state which are happening. It is quite different from the traditional CRUD architecture where usually only ...

Read More »

Easy validation in Scala using Scalaz, Readers and ValidationNel

I’m working on a new book for Packt which shows how you can use various Scala frameworks to create REST services. For this book I’m looking at the following list of frameworks: Finch, Unfiltered, Scalatra, Spray and Akka-HTTP (reactive streams). While writing the chapters on Finch and Unfiltered I really liked the way these two frameworks handled validation. They both ...

Read More »

Scala Days: 11 of the Best Speakers Share Their Slides

The slides behind some of the best talks at Scala Days Scala Days Amsterdam has swept us with tons of awesome Scala content, we had a great time attending the talks and showcasing Takipi’s new reactive monitoring solution. There were a total of 55 different sessions around all things Scala and some of the slides have already started popping up. ...

Read More »