How to abuse Kotlin extension functions
Today we’re going to discuss Kotlin extension functions. It’s a mechanism that allows adding new functions to existing classes that we can’t normally modify (e.g. because they come from another library). Calling an extension function looks like a regular function call on an object. Kotlin isn’t the first language that offers them. Only in JVM […]
Avoid too many function arguments
Code maintainability is a set of guidelines that help making our software easier or cheaper to maintain in long term. It is a cognate to the clean code which is about being able to understand other’s code. Today, I’m going to talk about avoiding too many function arguments. I will show how it translates to […]
Backpressure in reactive streams: a closer look
The backpressure is an important property of reactive streams. In simple words, it ensures us that the publishers do not produce new elements faster than we can process them. In this way, we avoid overloading our system. Over years, I noticed that many newcomers to the reactive world have trouble with understanding how backpressure affects […]
Creating batches with Project Reactor
Imagine an event processing service that consumes application events from a queue. It works well until one day, when it starts lagging. Events are processed with large delays, and the queues fill up. What happens? Most likely we experience a sudden spike of events and our service is not able to catch up. In this […]
Barriers in LMAX Disruptor
LMAX Disruptor is a high performance inter-thread messaging library for Java. When the first version appeared several years ago, it made a lot of buzz on the Internet thanks to the innovative approach to concurrency. This article focuses on event consumers and barriers in LMAX Disruptor. Barriers are an important part of Disruptor architecture. They […]
Efficient test startup: JUnit + Micronaut + Testcontainers
Some time ago I was wondering how to speed up the execution time of integration tests in my application. I was already using Micronaut framework which gave me a huge boost thanks to incredibly fast startup. But I struggled with Docker containers, started through Testcontainers library. In JUnit, they had to be restarted between test […]
Don’t be afraid of IF statements
For many years, Java language lacked reasonable support for functional programming. When lambdas appeared almost 8 years ago, it was a huge shift for everyone which paved the way to many of today’s main libraries and tools. However, soon after that I noticed a strange effect. Some developers were so impressed with new Java API-s […]