Code Smell of the year

Long parameter list


Too many parameters are difficult to read. 3 or 4 parameters should be the maximum. Parameters tend to become more and they can be cohesive, too.

This list of parameters are on your hitlist now. Keep an eye on them.


private String buildCustomerSummary(String customerFirstName, 
                                    String customerLastName,
                                    String customerTitle, 
                                    Address address){
    return customerTitle + " " + customerFirstName + " " + " " customerLastname + " " + address.getCity() + " " +
            address.getPostCode() + " " + address.getCountry();
}


Create an object from the parameters and use it to pass it to the function.

This is step four of the first part of the Refactoring kickstart beginner series. Here is the last step of part 1.