Pattern matching is one of the most important features in Scala. It’s so important that I may risk saying that it’s not “a” feature of Scala, but the feature. It affects every other part of the programming language to the point where it’s difficult to talk about anything in Scala without it being mentioned or used in a code example. You have already seen it — the match/case statements, the partial functions, and the destructuring of instances of case classes. For this very reason, many things I’m going to talk about here you already know, so feel welcome to…


Yet Another Event Streams Library

Introduction

I’m from Poland but now I live in Berlin and work for Wire, an end-to-end encrypted messenger. And I work there in the Android team even though I write my code in Scala. About two-thirds of Wire Android code is written in Scala making it unique among Android apps most of them being implemented in Java and/or Kotlin. Wire is a messenger and as such it must be very responsive: it has to quickly react to any events coming from the backend, as well as from the user, and from the Android itself. …


Functional Programming. The only possible way to write code according to some, a muddle of special characters and magic spells used by hipsters to show off according to others. In this series, I’ll try to convince you that it’s neither. Or maybe it’s both. I haven’t decided yet.

This is the first of a series about FP basics in Scala. It’s also my “manifesto” of a sort about simplicity in programming. I feel that in our quest to learn Functional Programming we sometimes skip over foundations and dive straight into advanced stuff. In consequence, naturally, the foundations of our…


The unapply method

You can think of the unapply method as the opposite of apply... d’oh. Say, you have that sealed trait Cat and its companion object. There are two apply methods defined: they take the colour of the cat (or its lack of colour, so to say) and create a cat of the given colour (or without). Since right now the colour is the only property of the cat, then with a bit of stretch of the imagination you may think of it as wrapping the cat around the colour… okay, let’s change the example and talk about squares instead.

A…


Paraphrasing Martin Odersky, the creator of Scala, Functional Programming is on its most fundamental level simply programming with functions. A function is a piece of code that takes some data as arguments, performs some operations on it, and returns the result as another piece of data. Adding 2 and 2 means executing a function. Both numbers are arguments. The name of the function is “add” if we want to use the standard notation, or “+” if we want to use an operator — both are equivalent. The result is 4.

Of course, not only numbers can be data. Although…


A photo of the author in front of a statue of Otto von Bismark with his dog. Bismarckplatz, Berlin, Germany.
A photo of the author in front of a statue of Otto von Bismark with his dog. Bismarckplatz, Berlin, Germany.
Tyras, Otto, and I

From the three of us on this photo, the best is Tyras, a Great Dane, who once attacked a Russian ambassador, Alexander Gorchakov. According to the story, the ambassador pointed something with his hand and Tyras thought that Gorchakov wanted to attack his human. Tyras was a very good boy and definitely deserves a statue.
The question if one of the other two deserves a statue is the subject of this text.

(By the way, if you see the paywall, and still want to read this text, here’s the friend link)

Hi. My name is Maciek. I’m the one in…

Maciek Gorywoda

Scala. Rust. Bicycles. Trying to mix kickboxing with aikido. Bad Buddhist. 🇪🇺

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store