Skip to content

Files

Latest commit

 

History

History
18 lines (12 loc) · 510 Bytes

ConstantsOnlyInterface.md

File metadata and controls

18 lines (12 loc) · 510 Bytes

Pattern: Interface with constants only

Issue: -

Description

An interface should be used only to model a behaviour of a class: using an interface as a container of constants is a poor usage pattern. Example:

public interface ConstantsInterface {
    public static final int CONSTANT_1 = 0
    public static final String CONSTANT_2 = "1"
}

Further Reading