Obviously your code is more readable with 3 or 4 arguments rather than 7 or 8, though there are some things you can consider.
If some of the arguments are closely related you can create a placeholder class. For example rather than arguments (int age, String firstName, String lastName)
you could use an argument (Person person)
.
Another case is where the arguments are all of the same type. In this case you can use a varargs
and the type signature will look like Type...
. varags documentation.
Whilst there is no hard and fast "rule", use your best judgement and think about the readability and maintainability of your code.