Java in Practice

Tackle real-world, practical Java solutions for common engineering problems which stand in the way of effectiveness.

GitHub Actions with Gradle to Set Up a Basic CI/CD Build

Posted on April 25, 2020
Build Workflow with GitHub Actions and Gradle

I don't know about you, but setting up CI and dev-ops tasks freak me out. There are so many different platforms, libraries and configurations to set up just right that I'm usually overwhelmed. But what if there is a more developer-friendly way? Let's look at how to set up a basic continuous development workflow using GitHub Actions with Gradle. No Jenkins, no external build servers, no fuss. All you need is a configuration yaml file in your ...

Read More

Clean Code – Book Review – Is it Useful for Software Engineers?

Posted on April 12, 2020
Clean Code Book Review

Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin (aka Uncle Bob) is the first book of the series named after the author from Prentice Hall, Pearson. Originally published in 2008, it represents a classic and still relevant resource for coding best practices, presented in the context of Agile principles. What Is Clean Code About? (more…)

Read More

Lombok Mutability Pitfalls and How To Avoid Them

Posted on December 31, 2017
Java Lombok Mutability Pitfalls

Find out how Lombok can unwittingly undermine good mutability and encapsulation practices and what to do about it. Object-oriented encapsulation best practices lead development towards only relying on mutators to change object state. Any other way of changing it is called a side-effect and is generally very unwelcome. Side-effects have a nasty habit of introducing bugs and seriously slowing down debugging as they tend to create non-determinism. ...

Read More

Java Package-Info Annotation Generation with Gradle

Posted on March 26, 2017
Generate Java default in Intellij Idea

Elegance and cleanliness in programming are important to me. Having a lot of files scattered everywhere is an eyesore. However, that is exactly what I've prescribed in my earlier post about Java default nullability annotation set by a package. To define default package contracts throughout your project, you need to copy the same package-info file in all packages. This does not only cloud visibility in the project view panel but ...

Read More

Set Java Nonnull/Nullable Annotation By Package for Cleaner Code

Posted on March 8, 2017

What is a Java Null Annotation? Java null annotation (or nullability annotation) contracts are a way to mark the code in a way that static checkers know which parameters, variables or return types can be null. You would especially want to do that if you hate defensive null checks everywhere in the code, like this one: (more…)

Read More