Categories
Programming

The problem with EitherT

If you’ve used Scala Future in a real application you probably realised that having a failed Future wrapping any Throwable isn’t the most efficient way to handle errors in your application. I used Scala Future in this example but it applies equally to cats effects. Any type like IO[A] suffers the same issue in that […]

Categories
Programming

Streaming patterns with fs2

After an overview of cats-effect which deals with single effect it feels natural to have a look at fs2 and see how multiple effects can be combined into a stream. As we’ve covered some common streaming patterns with Akka stream a while ago it’ll be interesting to see how they compare with each other.

Categories
Programming

Cats-effect, an overview

After many applications written using Scala’s Futures, Akka Actors or Monix,… Cats-effect is now my favourite stack to write Scala programs. Why is that? Well, it makes your code easier to write and reason about while providing good performances.

Categories
Programming

Dealing with errors

As a programmer we don’t really like to deal with errors. We like to focus on the happy path – the one that provides value – and deal with the errors later because … well, we have to do it! However dealing with failures is crucial if we don’t want our program to stop on […]

Categories
Programming

Leveraging the type system to avoid mistakes

We all know we should write tests to make sure our system behaves as it is supposed to. Surely tests are necessary to ensure correctness of our programs but they only depend on what the programmer is willing to test (or can think of testing). What I mean is that there will always be gaps […]

Categories
Computing

Load-Balancing strategies

A load-balancing strategy is a strategy allowing to spread the load (e.g. HTTP requests) over a fleet of instances providing some functionality. If you’re like me you probably think of a sort of load-balancer (e.g. Nginx, AWS ELB, …) in front of several nodes (e.g. EC2 instances, docker containers, …). This is, indeed, a very […]

Categories
Computing

Back-pressure in Grpc-akkastream

Grpc-akkastream, the akka-stream implementation built on top of GRPC looks good on the surface but if you look under the hood there is one problem: it doesn’t provide any support for back-pressure. Akka-streams (as any reactive-stream implementation) provides a way for back-pressure and GRPC (at least the Java version) also has an API that support […]

Categories
Computing

Making sense of SBT

SBT is probably the most popular (as in “most used”) build tool for Scala yet people (including me) experienced a hard time figuring out why it doesn’t perform as they expect. Originally known as the “Simple Build Tool” it has later been renamed to “Scala Build Tool” (maybe to acknowledge the fact that it was […]

Categories
Programming

Refined types, what are they good for?

Type refinement is all about making the types more precise. But why would do that? Because using the correct types makes your program safer as you reduce the possibility to introduce bugs. First let’s think about types. For instance String is a type we use all the time. A variable of type String can have […]

Categories
Databases

Querying DynamoDB from Scala

As we’ve seen in this comparison with Apache Cassandra, DynamoDB may be a valuable choice for storing data. It’s fully maintained by AWS you just have to configure your instance and you can start using it straight away. Being one of the Amazon web services DynamoDB offers a JSON/HTTP interface and Amazon provides a set […]