PicoContainer - Concrete Class Dependency

Symptoms

A class depends on other concrete classes. In order to favour decoupling (and thereby testability) we recommend depending on interfaces instead.

public class A {
    private final B b;

    public A(B b) {
        this.b = b;
    }
}

public class B {
}

Causes

Laziness

What to do

In order to reduce A's tight coupling, split B in an Interface Implementation Separation.

public interface B {
}

public class BImpl implements B {
}