Why is this an issue?

A function or procedure should have a single and well-defined responsibility. Such a function is easier to understand, change, maintain, test and reuse. Too many parameters is an indication that the function/procedure has too many responsibilities.

How to fix it

Code examples

Noncompliant code example

With default maximum number of parameters: 3

function too_many_responsibilities (length, width, height, color: integer) return integer;

Compliant solution

With default maximum number of parameters: 3

function single_responsibility (length, width, height: integer) return integer;

Resources

Articles & blog posts