This is not mud. Just sand. Photo from personal collection

Nowadays microservices are so popular that it is inevitable they are used in places where they should not.

Microservices is a pattern that has 2 main drivers: optimising for team size and system load. However, often they are used out of fear of monolith. Idea is that the only way to avoid big ball of mud is splitting the system into microservices from the start.

From the outset it makes sense. If I know that at some point I anyway need to split my system then why not skip the monolith phase and jump directly into microservices? …

Sometimes it can be hard to see production code behind the test trees. Photo from personal collection

Have you noticed that sometimes you need to write a lot of test code only to verify some very specific part of production logic?

When I come across this myself my first reaction is to hide all these uninteresting details. For example, by introducing factory methods or builders in test code. Often this is indeed good enough. However, before cleaning up the test this way it is good to think if it’s not the production code that needs some cleanup.

Tests that have low focus factor are a sign of badly designed production code.

Focus factor here is the ratio…

Sõrve lighthouse in Saaremaa, Estonia — non-software legacy from 1960s. Private collection

The term legacy is used quite broadly in software engineering. Typically it’s used to refer to a system or technology any reasonable person should avoid as much as possible. However, if we go deeper into trying to understand what legacy in software means we can uncover some more interesting insights.

Legacy as value

In Merriam-Webster dictionary legacy is defined as:

something transmitted by or received from an ancestor or predecessor or from the past

As legacy is something transmitted by an ancestor it means that it has some value (or at least had for the ancestors). Similarly having a legacy system means it’s…

Backlog from our team quarterly planning session

The biggest problem with ticket management systems like Jira is that they are too powerful. Having a backlog of 300+ items is no problem. Whenever some new topic is raised we always have an answer — “let’s create a ticket”. And then forget about it.

With 300+ items on the backlog majority of the tickets will stay there forever or until we throw the whole list away and start over again. This outcome does not differ no matter how much time we have invested into “backlog grooming sessions”.

I’m a big fan of the approach that Basecamp is using where…

Healthy candies tested on my kids. Private collection.

As a parent I often face the challenge of having to explain the hidden dangers of unhealthy life habits. Interestingly, I have realised that the way we tend to treat our own health and the health of our software have a lot in common.

Eating unhealthy food and no regular exercising will lead to worse health. Unfortunately this will not happen immediately — especially if you are young. The side effects of such habits may take long time to appear. This makes it quite hard to fight against these habits early on. Just like with software systems we don’t usually…

Nullable lamp. Photo from private collection.

Previously I wrote about avoiding nulls using NullObject and Optional method return value. In this post I will focus on modelling optionality in an object internal state in cases where NullObject is not suitable. This means when implementing the basic building blocks for internal state of Value Objects and Entities or working with data structures instead of behaviour.

If we keep our classes small then this is a much smaller problem than having nulls passed around between objects. Still, the more of the actual domain constraints we are able to convey in our static code structure the better. …

Photo from personal collection

Let’s say we want to implement a service that handles the process of placing an order. This order goes through multiple stages during its lifetime. Initially it is pending, then goes to confirmed and paid. Finally it ends up as either completed or canceled.

Now going to implementation it seems obvious that we need a class named Order. Simplest way to model the states that it goes through is having an OrderState enum.

There are different things that we can do with an Order in each of its states. For example, in pending state we can change any details (e.g…

A military installation from Soviet times in Northern Estonia

Null Object and Optional are both ways to avoid nulls. In the following post we will compare these two approaches to see when one or the other is more suitable.

Null Object

Null Object pattern is nice as it hides away the special case of not having a value for something. So ideally we should be able to avoid all ifs for null checks. This works nicely when we can replace normal behavior with a noop implementation. However, it does not work so well when we need to access some data on the object.

For example, we have a Customer class like…

Four singleton beans

In this post we will look into using port level tests to make microservice testing experience faster/more pleasant. As a nice side effect we will also improve our application design.

This post contains some Spring specifics but the idea itself should be applicable to any similar framework.

Test Categories

Having clear test categorisation with explicit guidelines is very valuable within a team/service. This way we can avoid amorphous tests that follow random patterns and are hard to read.

There are many ways how to categorise tests. …

Ceiling of a hall at PROTO invention factory

Entity services are services that are modelled around data instead of behavior. It’s an antipattern when implementing “Service” classes in a single monolith. Entity services are even worse in microservices architecture where they inevitably lead to distributed monolith.

One way how to avoid such entity services is intentional naming. Naming is very powerful way how we can direct our thinking and create positive constraints for software designs. If we want to build services that are formed around behavior and not data then we should also name them using verbs or processes instead of nouns.

Name services using verbs instead of…

Ürgo Ringo

Have been creating software for 20 years. Last 7 years worked as IC and team lead at (Transfer)Wise. Currently working as VP of engineering at CleanKitchen.

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