CodeImprover Technical Reference

Metric Name: 

Number of Parameters


This number indicates the number of parameters to a method or a constructor.

Default setting:

Any method or constructor with more than seven parameters triggers negative Observation Score points.


Typically parameters can be roughly grouped into two subtypes: data and dependencies. If a method or a constructor takes too many dependencies it often means that the method or class is dealing with too much responsibility. If too many data arguments are used as parameters it is often recommended to make a class containing all data arguments. This improves maintainability and eases encapsulation.

What to do:

Consider making a new dependency (class) that groups the tasks of two to three of the parameters. In this way, you can remove two to three parameters by adding only one.

Context – How it works
Back to – Metrics reference overview