Or at least we will talk today about one of a few ways to do it. If you want to learn more about what is possible, and why it might be a good idea to consider an alternative to standard Android app development, please take a look a look at this article on Scala on Android or watch the associated conference talk.

But today we will talk about how to use GraalVM Native Image to compile Scala code to a file executable on Android, with Gluon libraries to access the Android platform beneath, and JavaFX for Graphical User Interface. Scala…


CODEX

The simple answer to how immutability helps with thread safety is — basically the same as with laziness. If data does not change it means that any number of threads can access it at any moment and they don’t mess with each other. But of course, the whole point of running a program is that we want to do something with data, not just read it. Data on which the program operates has to be mutated at some point in time, and so if the program runs on two or more threads, those threads can access the data and…


This is a blog post made from a transcription of a conference talk I gave at ScalaLove in February 2021. A link to the video will be added when the video from the conference is published.

For four years now I develop the Android client of Wire, an end-to-end encrypted messenger, written in Scala. In Android we deal a lot with events coming from many sources: the user, the backend, the Android OS itself. The code we write has to be very reactive — and it should also be concise and able…


Alexei Navalny
Alexei Navalny

We were friends for the last four years. We are no more. But it does not mean we can’t be again.

Yes, I saw those videos of Alexei Navalny from years ago, where he compares immigrants to a rotting tooth. I didn’t like it. I also know his views about Crimea and I don’t like it too. Navalny is definitely not a saint. He made mistakes in the past. He will probably make mistakes in the future.

… That is, he will, if he is ever free again.

See, nobody is a saint. We all make mistakes and we all…


I decided to write this article because I remember that back when I started to learn Scala around 2013–2014 the problem of how to return early from a loop actually happened to me a few times. I had a collection which I wanted to go through looking for the first entry which fulfilled some requirements, and then I wanted to jump out of the loop, taking that fitting result with me. At the time I was working in Java on a time-management webapp and situations as the one described above happened to me pretty often: There were long collections of…


One very cool thing about programming with functions is that data we work on does not have to be mutable so often. In theory — and languages like Haskell — it’s possible to never use mutability, but the alternative solutions can sometimes be pretty complicated or at least very weird-looking for an average coder. …


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…


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. …


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…

Maciek Gorywoda

Scala. Rust. Bicycles. Trying to mix kickboxing with aikido. Trying to be a better person too. Similar results in both cases. 🇪🇺 🇵🇱

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