Getting Rid of Nasty Parameters – PMD Rule “Excessive Parameter List” Explained

I bet you’ve seen code like this when your IDE auto-completed a function call in your code and there’s no source code or Javadoc found:

emailSender.sendEmail(String arg1, 
    InternetAddress arg2, InternetAddress arg3, InternetAddress arg4, 
    String arg5, String arg6, List<EmailAttachment> arg7);

But what does this mean? In this article, I will disclose this secret and show you a few techniques for refactoring (or avoiding!) these parameter lists.

Read more…