My blog about programming, computer science, and other stuff.

Everything here is my personal opinion and is not related in any way to my current, past, or future employers.

The Trolley Problem is a Red Herring

I wrote this in March 2018, but for some reason never published it. Back then, there was an ethics debate based on the trolley problem. If I remember correctly, this was triggered by by MIT’s Moral Machine. Example scenario from MIT's Moral Machine For a while, the media loved to discuss the trolley problem for self driving vehicles. Finally these thought experiments for theoretical ethics could be applied to something practical.

Stream.forEach() overuse

Starting with Java 8, Java programmers can enjoy the merrits of functional programming thanks to lambdas, java.util.function.* and the stream API. This is great, and allows to improve readability. For example, conversions of lists can be written in a relatively succint way: List<String> hosts = urls.stream().map(URL::getHost).collect(Collectors.toList())); That is much nicer and easier (or at least faster) to read than this: List<String> hosts = new ArrayList<>(urls.size()); for (final URL url : urls) { hosts.

Caraway Soaker Sourdough Bread

What I like about old bread soakers is that they are a good way to get water into the bread and that I can recycle some old bread that I have left over. I based this bread on the Rauriser Weizensauerteigbrot from Plötzblog. I added a soaker using toasted slices from a previous attempt to make the Rauriser Weizensauerteigbrot. While preparing the soaker I remembered that I have caraway. My previous attempt to use caraway in a bread was a bit disappointing.

Bagel Sourdough Bread

I wanted to toast a frozen bagel in the oven, but forgot it. So I got a bagel that was a bit too dark and dry. Hence, I decided to use it as a soaker for a rye/wheat bread. The result was a flavorful bread with compact crumb. Unfortunately, I only documented a part of the baking process. This recipe is a rough approximation of what I did.

Reversing a Linked List

Linked lists are an important data structure and also a popular source of interview questions. Few programmers will actually have to do a fully fledged linked list since most programming languages come with an implementation of it (usually of doubly linked lists). Nonetheless, understanding linked lists and other data structure will help you better understand runtime consequences of choosing one data structure over another. Reversing a linked list is a common task.

Functional Java

With Java 8 the language got lambdas. This is a huge step towards allowing functional programming in Java and hence brings a fresh breeze. The language designers did not stop by simply providing lambdas but also extended the runtime API significantly to support lambdas and functional programming. What are lambdas? The Java Documentation for Lambda expressions gives a rather dry definition: “Lambda expressions let you express instances of single-method classes more compactly.