Learn how to use WebSockets in Scala with Http4s, and how to enable two-way communication between the frontend and the backend.
Posts by Year
Learn type classes in Kotlin - a powerful ‘design pattern’ to organize your code better and make it easier to read, understand and change.
Learn how to write a full-stack Scala 3 application with Cats Effect, Doobie, Http4s and Tyrian, from scratch.
Understand how UDP works, and how you can transition from an old Java NIO implementation to a higher level API like FS2 in Scala.
Learn how to use type-level programming to solve practical problems.
How to build an application load balancer with Scala & Cats Effect, featuring efficiency and concurrency. Tests included!
A long-form guide on how to make microservices communicate with gRPC in Scala.
It’s time to end our journey on functional error handling in Kotlin with the new features introduced by the Arrow library in version 1.2.0. We’ll focus on th...
A story of a beginner developer learning and working with Scala.
Learn the basics of Play Framework to build robust HTTP APIs with Scala, in this long-form tutorial.
Learn how to implement OAuth authentication in Scala using Http4s, using GitHub as an OAuth provider.
Learn how to write a two-factor authentication mechanism using one-time passwords (HOTP and TOTP) with Scala and Http4s.
This tutorial describes Kotlin context receivers, a new feature of the Kotlin language for nice and controllable abstractions.
In this article, we continue our journey through functional error handling by looking at the Result and Either data types and how to use them.
Learn how you can implement HTTP authentication with Scala and http4s, with 4 different methods: basic, digest, session and JWT tokens.
Discover the best Scala course for your learning journey. Explore the recommended courses and libraries like Cats Effect, ZIO, and Apache Spark.
Whether we develop using an object-oriented or functional approach, we always have the problem of handling errors. Kotlin offers a lot of different methods t...
In this article, we will show you how to set up an Http4s server so that it correctly protects against cross-origin requests and CSRF.
Project Loom and virtual threads promise to bring modern concurrency paradigms that we already found in Kotlin (coroutines) and Scala (Cats Effect and ZIO fi...
Interoperability between Akka Streams and actors with code examples
A hands-on guide to Flink SQL for data streaming with familiar tools.
Tips on how to make Kafka clients run blazing fast, with code examples.
Scala CLI is a great tool for prototyping and building Scala applications. We’ll use scala-cli, Scala Native and decline to build a brute-force sudoku solver.
Kotlin coroutines are a powerful tool for asynchronous programming, and they fall under the umbrella of structured concurrency. Let’s check out their main fe...
Finagle is a powerful and deceptively simple library for distributed systems, with built-in HTTP support, load balancing and more
Learning Scala doesn’t need to be hard. Here are 10 mental skills you can learn to be a good Scala developer.
How to approach Sudoku and other constraint-satisfaction problems with recursive backtracking in Scala.
How to set up an HTTP server with zio-http, the HTTP library in the ZIO ecosystem.
Learn how to set up and configure your Scala projects with SBT in this long-form tutorial.
A comprehensive introduction to ZIO streams, a powerful abstraction in the ZIO ecosystem.
An introduction to the popular database library in Scala: Slick.
We discuss how you can integrate Apache Pulsar with Apache Flink to perform data enrichment with state from different topics.
One of the most prominent Rock the JVM students shares his insights to a successful career in Data Engineering.
Scala Options are some of the first things we learn - but why? What do they do, and why are they useful?
A tutorial on the Free monad in Scala, how it works and what it’s good for.
Scala general type projections are unsound and were removed in Scala 3 - what do you mean?
Scala generics are easy to understand if you come from a Java background. But what about Python or JS folks?
Akka, Cats and Cassandra in a bigger Scala project integrating multiple pieces in the Scala ecosystem.
A common pattern in Akka Typed: how to find actors that are not explicitly passed around.
The ultimate 10-minute tutorial to a Snake game in Scala.
The ultimate tutorial to purely functional streams in Scala with FS2.
We’ll discuss the role Apache Pulsar plays in the event streaming and computing landscape, the use cases you can implement with Pulsar and when more advanced...
Wrapping up 2021 with an overview of what’s happened this year at Rock the JVM.
We rely on the JDBC specification if we need to connect to SQL databases in the JVM ecosystem. However, JDBC is not a good fit if we use functional programmi...
Demystifying the tagless final pattern in Scala. TLDR: it’s got nothing to do with type classes.
We’ll take a look at some core Scala constructs and look at them from a different angle than we’re used to.
Akka Streams implements backpressure, a critical component of the Reactive Streams specification. This article is a demonstration of this mechanism.
Apache Kafka is clearly the leading technology concerning message brokers, and Kafka Streams brings a complete stateful streaming system based directly on to...
Level 90 of type-level programming: a real sorting algorithm on lists… as types.
Learning how to use the power of givens to infer type relationships in Scala 3… at compile time.
Apache Pulsar is a cloud-native, distributed messaging and streaming platform that manages hundreds of billions of events per day. We’ll learn what makes it ...
Pattern matching is one of Scala’s most powerful features. In this article, we’ll how to customize it and create our own patterns.
We’ve talked about monads quite a lot on Rock the JVM. In this article, we’ll approach them from yet another angle.
Apache Kafka has proven itself as a reliable and scalable communication bus between distributed application components. We’ll learn to use ZIO to interact wi...
Referential transparency is your best tool for productivity as a functional programmer in Scala. In this article, we’ll talk about what it is and why it’s im...
In this article, I’ll show you how you can exploit the implicit resolution mechanism in Scala to enforce type relationships at compile time.
Showing a Scala 3 trick that few developers know: exploiting the absence of a given instance to enforce type relationships.
Many libraries implement the effect pattern in the Scala ecosystem, and every one has its own concurrency model. First, let’s introduce the ZIO library and i...
Once we learned the basics of functional programming, it’s time to understand how to use them to expose APIs over an HTTP channel. If we know the Cats ecosys...
Cats is a complex library for Scala. In this article, we’ll deconstruct the major type classes of Cats and explain how they’re connected.
In this article, we’ll go through the major testing styles with Scala and ScalaTest, and we’ll understand what ‘FunSuite’, ‘FlatSpec’ etc mean.
A short article with a powerful idea about functional collections many Scala programmers do not know about.
After the previous introduction to concurrency in Cats Effect, we’ll look at how to manage racing IOs and fibers.
A quick dive into asynchronous computations with fibers in Cats Effect 3, written for Scala 3.
Deconstructing extension methods, one of the most exciting features of the upcoming Scala 3.
What’s the problem?
This quick article will show you how given instances in Scala 3 can work with Scala 2’s implicits.
In this article we’ll see a good practice for organizing code, messages, domains and logic in an Akka application with Scala.
This article is about Monoids and Semigroups as a gentle introduction to functional abstractions and to how the Cats library works.
Learn how to approach a Google-style algorithm interview question in Scala with pure functional programming.
ZIO layers (ZLayers) help us structure our complex services into modules that are independent, composable and easy to understand. Let’s take a look.
An ad-hoc type definition technique for eliminating bugs which are hard to trace, with implementations in Scala 2 via newtypes and in Scala 3 via opaque types.
Although frowned upon by FP purists, creating and managing mutable data structures is important in any language. Scala has some first-class features.
Error handling is likely one of the most frustrating part of programming, and in Scala, there are better and worse ways to do it. Let’s take a look.
Scala 3 comes with lots of new features. In this episode, match types: a pattern matching on types, and a tool for more accurate type checking.
Sorting lists might be a “school” problem, but in this article I’ll show you how to use proper FP, tail recursion and more, using this popular example. Might...
Every developer using Scala meets the acronym ADT sooner or later. In this article, we will try to answer all of your questions about ADTs.
This article is for the starting Scala programmer: an introduction to singleton objects and companions in Scala, what they can do, and why and where we shoul...
In this article, we’ll explore one of the most used (and useful) concepts in pure functional programming: the Functor. Pretty abstract, so buckle up.
In this article I’ll wrap 2020 and share a few insights, achievements and changes, and I’ll project some plans for the future of Rock the JVM.
I’ll show you a technique to use lazy values and call-by-name for recursive value definitions and implement a fully immutable doubly-linked list in Scala.
This quick tutorial will show you what dependent types are and how they work in Scala 3, along with dependent methods and functions.
From the previous article, you know how givens work. Let’s compare them with the old Scala implicits.
The given/using clauses are some of the most important features of Scala 3. Read on for the essential concepts and how to use them.”
We’ll take a look at the famous “covariant type occurs in contravariant position” problem, and what we can do about it.
Some people love it, some hate it. Scala 3 indented syntax is not that bad, and it might actually help. Let’s take a look at how Scala 3 can change the struc...
Akka Typed has not only made fundamental changes in the actor protocol definitions, but made significant improvements in actor mechanics as well.
Akka Typed has fundamentally changed the way we create actors. In this article we’ll look at several ways we can keep state inside Akka actors.
It’s obvious that Spark allows us to join tables. What’s not obvious is how many different kinds of joins Spark supports. We explore them in this article.
Broadcast joins in Apache Spark are one of the most bang-for-the-buck techniques for optimizing speed and avoiding memory issues. Let’s take a look.
Exploring a quick but powerful structure in Scala 3 - type lambdas. This will help you think higher-level.
Scala has a powerful type system. We look at how Scala types can be organized, what type constructors are, and why we should care.
We discover opaque type aliases in Scala 3 and how we can define new types with zero overhead.
This article will continue some of the previous explorations of Scala 3. Here, we’ll discuss some of the new functionality of traits in Scala 3.
Scala 3 introduces enums. About time! Even though it might seem like something minor, it has important implications.
Scala 3 introduces some new kinds of types, which we’re eagerly awaiting for.
A really nice way to inspect, extract and modify deeply nested data structures in Scala.
Akka HTTP needs JSON like humans need water. We show you how to integrate Spray-Json, Circe and Jackson into Akka HTTP.
Scala code is super easy to deploy to AWS lambda. We show you how in this step by step tutorial.
We look at how we can impose constraints on values at compile time with the Refined library.
Scala syntax is so confusing sometimes - I’ll show almost all uses of underscores in Scala. Sometimes the philosophy is inconsistent, but it’s worth at least...
Drawing the line between two fundamental repartitioning operations in Apache Spark.
We explore some not-so-well-understood territory in the form of eta-expansion and how methods and functions interoperate.
Final blow in the type-level trilogy. We learn how to sort lists… at compile time.
We continue down the path of type-level power in Scala. We learn to add numbers as types, at compile time.
This one is hardcode. We make the Scala compiler infer type relationships for us at compile time. Pure power.
Abstract classes and traits share a lot of overlap in Scala. How are they actually different?
Various constructions like “20.seconds” look like baked into the Scala language. Let’s see how these work.
We explore the various flavors of nothing-ness in Scala.
Akka Streams has the Graph DSL, which is one of its most powerful APIs. Learn how to use it and get started quickly with Akka Streams.
We compare three of the most popular streaming libraries and see where Akka Streams, Kafka Streams and Spark Streaming are most useful.
FP fans talk about pure functional programming in Scala with type classes. They’re hard. Why do we really need them?
Akka HTTP is super easy to deploy to a web server. Learn how to use Heroku and deploy your first Akka HTTP service in minutes.
A Scala tutorial on Monads that makes no assumptions and starts from practical needs. We derive the monad patterns (“laws”) from scratch.
Scala is an amazingly expressive language, but even the most experienced devs aren’t aware of all the subtleties.
Yep, you can write your own interpolator that looks like it was built into the Scala language. Learn how.
Akka Typed is one of the best things that happened with the Akka API. We explore how good practices are baked into the API directly.
We discuss the tradeoffs between 3 different styles of writing parallel code, in terms of thread use (and other effects) in Scala and Akka.
Learn to read files in Scala like a boss and compare it to other styles in other languages. We write a simple API which looks almost as easy as Python’s read...
Maximize the call-by-name semantics in Scala and manipulate your results when you want them.
We walk you through one of the foundational skills for Spark performance optimization: reading the Spark UI and the graph of how your job is structured.
We go on a short trip to Nothing (and nothing-ness) in Scala. Nothing is actually pretty useful.
Daniel goes into another rant about learning (and teaching) Scala using loops. Are they actually useful?
We demystify one of the hardest concepts in Akka Streams: materialized values.
In this article you’ll learn one of the most important Spark skill: reading how your job will run. This is foundational to any further Spark optimization.
Daniel goes into a small rant about learning (and teaching) Scala using variables.
For OO programmers looking to dive into functional programming in Scala: a gentle introduction to functions working with other functions.
In this article we learn to address the problem of “deterministic” Futures in Scala, using Promises.
Self types are a really interesting way to enforce type constraints in Scala. Learn to use it in a few minutes.
Learn to use Akka HTTP with Scala and send HTTP requests in just a few minutes with the Akka HTTP server DSL.
The Scala type system is powerful, but also hard. We look at contravariance in Scala and try to make some sense out of it.
Pattern matching is one of the most powerful Scala features. Learn to use it to the max so you can write your best Scala code.