Datafaker: An Alternative to Using Production Data

As developers or testers, we frequently have the need to test our systems. In this process, be it unit testing, integration testing, or any other form of testing, the data is often the leading and deciding factor. But getting access to good data isn't always easy. Sometimes the data is quite sensitive, like medical or financial data. At other times, there's not enough data (for example, when attempting a load test), or sometimes the data you're looking for is hard to find. For cases like the above, there's a solution, called Datafaker.

Datafaker is a library for the JVM suitable to generate production-like fake data. This data can be generated as part of your unit tests or can be generated in the form of external files, such as CSV or JSON files, so it can serve as the input to other systems. This article will show you what Datafaker is, what it can do, and how you can use it in an effective way to improve your testing strategy.

Better Logging With TinyLog 2

Most, if not all, Java and Android developers have come across logging requirements in their application. The most commonly known Java logging frameworks are Log4j2, Logback, and JUL (Java Util Logging), and most people have probably used SLF4J, the abstraction on top of these logging frameworks.

A lesser-known logging framework is TinyLog, and soon its successor, TinyLog 2. This blog post will dive into TinyLog 2, hereafter referred to as TinyLog, and in this post we’ll dive into what sets TinyLog apart and how to use it.

Immutable Data Structures in Java

As part of some of the coding interviews I’ve been conducting recently, the topic of immutability sometimes comes up. I’m not overly dogmatic in it myself, but whenever there’s no need for mutable state, I try to get rid of code which makes code mutable, which is often most visible in data structures. However, there seems to be a bit of a misunderstanding on the concept of immutability, where developers often believe that having a final reference, or val in Kotlin or Scala, is enough to make an object immutable. This blogpost dives a bit deeper in immutable references and immutable data structures.

Benefits of Immutable Data Structures

Immutable data structures have significant benefits, such as: