20 05, 2021

Explicit access permission design with user roles

By |May 20th, 2021|Architecture & Design|0 Comments

Most applications need access control and must therefore implement user permissions is some way. In a lot of the projects my colleagues asked me how I would implement user permissions. Since a lot of them found my thoughts an interessting way of implmenenting user permissions I want to share my thoughts here with you […]

22 02, 2021

How to test randomness?

By |February 22nd, 2021|Uncategorized|0 Comments

In this blog I want to show you one way of how to test randomness.

Randomness often appears when programming games. Let’s say you have a class that uses randomness, like a dice. When someone throws a dice it can be in one of six states 1,2,3,4,5 or 6. Thus you might implement the dice […]

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 […]