Skip to content

Latest commit



62 lines (42 loc) · 2.65 KB

File metadata and controls

62 lines (42 loc) · 2.65 KB
Root.Smell.ClassSmell.ClassSize.ClassConstants Parent Index
Sibling aspects ClassInstanceVariables ClassLength ClassMethods


Number of constants in a class.


Taste Meaning Values
max_constants Represents the max number of constants for a class 3

* bold denotes default value


This aspect does not have any sub aspects.


// Here is an example of class with too many constants if we assume
// that the maximum number of constants per class is 4

class Aclass {
    final public int a = 1;
    final public int b = 2;
    final public String c = "coala";
    final public String d = "aspectsYEAH";
    final public Boolean e = true;

    public Aclass(){}


Avoids having too many constants to spare developers from the neeed to remember too many of them.

How to fix this

ClassConstants issues can be fixed by using data classes.