Using service loaders

Although we progressed through to a working, modularized solution for our string matchers during the last article, we still have an unwanted dependency that goes directly from module matchers.cli to matchers.impl. This prohibits us from using a clean and extensible way of injecting implementations of the Matcher interface. Working through this article, our goal is to end up with a very loose coupling between our Java modules by implementing a mechanism for that kind of dependency injection.

more ...

Modularizing an existing codebase

During the course of this article we will migrate an existing Java 8 application to a fully modularized Java 9 application that leverages the capabilities of the Java Platform Module System (JPMS). This article is the first installment of a series of articles that showcases a migration path towards a loosely coupled and modularized application architecture.

more ...

Property-Based Testing in Java 8

In the last article we learned how to generate objects with Java 8 in a functional way and implemented a small API based around the Gen monad. Although already powerful on its own, generators really shine when we use them in combination with property-based testing. A property-based test verifies a statement about the output of your code based on some given input. The same statement - or property - is verified for many different possible inputs to find one that falsifies the property. This article builds upon the implementation of Gen and discusses a simple API that enables us to write property-based tests.

more ...

Functional Generators in Java 8

I recently had the chance to toy around with property-based testing. Property-based tests verify statements about the output of your code based on some input, where the same statement is verified for many different possible (admissible and inadmissible) inputs. Such tests rely heavily upon randomly generated objects and values. Even if you do not fully commit to property-based testing, having abstractions for generating random objects and values from your domain can simplify testing a lot. This article shows how to build a simple generator-based approach that plays well along with property-based testing and can simplify your test cases tremendously.

more ...