It started when David tried to access a Singleton and got a null-pointer exception. Then he noticed some bugs where the Singleton had inconsistent state. And then he looked at the code…

public class KpiService {
    private static KpiService instance = null;

    public static KpiService getInstance() {
        return instance;
    }

    public KpiService() {
        instance = this;
    }
    /* SNIP */
}
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!