Methods with too many parameters can be complex

Software EleganceCode Complexity

Why you should care

For developers, it is important to consider that having too many arguments tends make the function excessively complex.  This increases development time as it becomes more difficult for others to use, and understand the offending sections of code.

Business Impacts

Having too many parameters makes it difficult for developers to understand how to use a code base and collaborate on portions of code. This leads to high levels of backtracking and debugging, since developers have to remember and understand complex aspects while they are working. It is important to reduce this complexity to reduce needless expenditures of developer time and effort.


CAST Recommendations

Implementing a style guide for all developers which outlines the maximum number of function arguments and places an emphasis on proper abstraction methodology for your application. Adding more layers of abstraction and further subdividing functions will reduce the complexity.

How we detect

This code insight counts one violation each time a function has more than X arguments where X is defined to 3.


About CAST and Highlight’s Code Insights

Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.

See featuresHow it works