Image by Suket Dedhia from Pixabay

This article is written after an evaluation of trunk-based development and feature toggles for my project. It might be opinionated, but I tried to present a holistic explanation of why you might want to move from feature branching to trunk-based development and how you can do that using a set of different techniques and best practices.

Feature Branching

Feature branching is an approach where you create a branch in your repository for every task or feature. Depending on the size of your features, implementing them may take weeks and even months. …


Image by analogicus from Pixabay

A hidden gem in the standard Java library is the RuleBasedCollator class. It allows you to define custom collation — a set of rules for comparison between different characters in a string — in a flexible way. Your use cases might be one of the following:

  • you need to sort strings with uppercase characters with higher or lower priority than lowercase characters;
  • you want to set higher or lower precedence for characters with an accent (like à) or any other non-Latin characters;
  • you need to specify any other non-standard rules for character precedence that would be too complicated to define…

Image by Alexas_Fotos from Pixabay

Disclaimer: debugging is one of the most important techniques in the toolbox of every software developer. Investigating issues in your code by interspersing it with “print” statements or slightly changing it until it works is rarely a good solution, so “learn how to debug” is the best advice you can give to a less experienced developer.

And here I am, saying that you should stop debugging. Yes, as soon as you learn how to debug, you have to immediately start to un-learn it.

Debugging is a great technique, but it should be used sparingly. If you blindly jump into a…


Image by Vicki Hamilton from Pixabay

In this article, I’ll describe a cool concept of functional programming, type classes, on the example of the Haskell programming language. I’ll start by providing some Java examples and go through the limitations of the Java language and its object-oriented paradigm. I will then describe how those limitations are lifted when moving into the functional programming world.

The article is targeted mostly at Java developers, but knowledge of any object-oriented language will do. You don’t need to have any prior experience in Haskell before you read the article. However, I would be happy if you become interested in this wonderful…


Image by Pexels from Pixabay

In this article, I’ll describe a trick from the Jackson JSON parsing library that allows parsing non-typical JSON with greater flexibility.

Sometimes you can’t influence the structure of JSON that you get — for instance, you work with legacy data or consume it from another system. When parsing a record of a person, you usually expect something like this:

{
"name" : "Jane Smith",
"rate" : 4.2,
"age" : 42
}

However, you might get all properties of a person just as elements of an array, without property names:

[
"Jane Smith",
4.2,
42
]

The first element of the…


Image by matrishva vyas from Pixabay

Whether you support an open-source repository and need to accept PRs once in a while, or are involved in the code review process for your company’s project, doing a good code review is hard. Depending on your dedication, it may take up to half of the time that was spent by the author of the code on the actual implementation.

Here are some principles that should help you make the code review effective and productive and provide the best output for the author and yourself.

Automate as Much as Possible

A lot of the things typically checked during the code review are easily automatable. Linters…


Image by 👀 Mabel Amber, who will one day from Pixabay

GnuPG (gpg) is a great utility that is usually available both on Linux and Mac. It can be used for generating encryption and signing keys and using them to encrypt and decrypt your sensitive data. Here’s a quick cheat sheet for basic usage scenarios.

Generating a new key

Generate a new gpg key:

gpg --full-generate-key

The utility will ask some questions, for most of them the default values are fine:

  • What kind of key you want? (RSA and RSA)
  • What keysize do you want? (3072)
  • How long the key should be valid? (the key does not expire)
  • Real name? (Input a name to identify…

Image by SweetMellowChill from Pixabay

In this article, I’ll explain in detail the solution for the “Strange Printer” coding problem. It’s featured on multiple coding exercise websites, you may have encountered it at LeetCode by the number of 664.

Problem description

Suppose you have a printer whose purpose is to generate a string of lowercase English characters. The limitation of the printer is that at each step, it can only print a string containing the same character, e.g. , , or .

The trick is that the printer doesn’t print out the steps in sequence, but rather can start printing at any place, possibly overwriting the results…


Image by Prettysleepy from Pixabay

Sometimes you may want to move or advance a tag as part of your GitHub Actions pipeline.

First, make sure you know what you’re doing — moving tags in a git repository is generally a bad idea, since it may mess with other people’s repositories and incur non-reproducible build and deployment issues. However, there are some workflows and cases that justify moving tags.

For instance, you may have a , or a tag in your repository, which you use to execute a nightly build.

If you want to manually move a tag using your local development environment, this would…


Image by HowardWilks from Pixabay

You may wonder how long a particular line of Java code executes. If this line is part of your code, it’s easy to find out by putting calls before and after the line and finding the difference. But what if this line of code is part of a library or a framework? You could use a profiler, but a quicker and easier way might be to use breakpoints in IDEA.

Put a breakpoint on the line you want to profile (e.g. …

Sergei

Technical project lead @ CRX Markets. I mostly write about Java and microservice architecture. Occasional rants on software development in general.

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