6 12, 2018

Breaking static dependencies using Java 8 lambdas

By |December 6th, 2018|JDK, Lambdas, Method References, Unit Tests|0 Comments

Static dependencies are usually bad , because that dependencies are based on the class level and class objects can not be replaced at runtime in contrast to object instances.

That’s why static dependencies are usually a pain if it comes to tests. When you want to write a unit test you usually want to mock […]

23 10, 2017

Global java vm arguments

By |October 23rd, 2017|JDK|0 Comments

When you start a Java virtual machine you can specify various vm arguments. Some alter the memory management, some the garbage collection and some are system properties.

But you can also specify global vm arguments that are picked up by every virtual machine that starts within an environment context.

These global options are specified using the […]

6 07, 2017

One dot per line saves time

By |July 6th, 2017|Architecture & Design, Java|0 Comments

Today I want to introduce you to a simple rule that I apply when developing software. This rule often saves me a lot of time and it is simple to apply. I usually write code in Java and so the rule is made for Java programming in the first place, but it might also be adapted […]

19 05, 2016

Make method pre-conditions explicit by design

By |May 19th, 2016|Architecture & Design, Java|0 Comments

A method usually makes assumptions about the arguments that are passed into it by a method invocation. The conditions that the arguments must fullfil are named the method’s pre-conditions. Thus a good method implementation checks if the arguments are in an expected state so that the method can execute.

Often developers use basic data types as method parameters like String, […]

19 03, 2016

Progress Object Pattern

By |March 19th, 2016|Architecture & Design|0 Comments

When a user executes a long running background task an application usually wants to report progress about the task to the user. Application developers often do this by passing a ProgressListener to the background task’s  method and the method uses the ProgressListener to report it’s progress. But you can also design it in another way and I would like to […]

2 01, 2016

A plug-in architecture implemented with java

By |January 2nd, 2016|Architecture & Design|0 Comments

Instead of building monolithic applications developers prefer modular and extendible applications. Either they want to use the flexible architecture by themselfs or provide a plug-in api for other developers. In both situations one must define a modul’s purpose and it’s boundary. This module boundary is also called the service provides interface (SPI) or also a plug-in api. Java’s jar […]

3 12, 2015

Enums as type discriminator anti-pattern

By |December 3rd, 2015|Architecture & Design, Unit Tests|3 Comments

In Java 1.5 enums were introduced to ease handling of constant values. Enums can improve code quality, because they are types that the compiler can check. But they can also be misused and lower the code quality. In this blog I want to discuss the misuse of enums as type discriminators and show you why this […]

1 05, 2015

Singleton implementation pitfalls

By |May 1st, 2015|Architecture & Design|0 Comments

In this blog I want to show implementation pitfalls of the singleton pattern and show you why enums are the better singletons.

The singleton pattern is widely known and discussed a lot of times. Developers often prefer to implement a singleton using a final static field. But this approach has some pitfalls or rather malicious code can […]

25 04, 2015

Instanceof vs. polimorphism

By |April 25th, 2015|Architecture & Design|0 Comments

An instanceof check is often an indication for misplaced source code. Some developer say that instanceof checks are ugly code, but there are reasons against instancof checks beyond a subjective feeling. In this blog I want to compare instanceof checks with polymorphism and discuss the downsides. This blog is intended to be used as a basis for desing decisions and discussions […]

19 04, 2015

How to partially revert a commit in git?

By |April 19th, 2015|Git|2 Comments

Reverting commits in git is quite simple if you want to revert a whole commit. But how to partially revert a commit? In this blog I want to show you a safe approach to partially revert a commit.