Long Parameter List

noun

say it: “LAWNG puh-RAM-ih-ter list” /lɔŋ pəˈræmɪtər lɪst/

A code smell where a method or constructor takes so many arguments that a call to it can't be read.

What is a long parameter list?

A long parameter list is a code smell: a method or constructor that takes so many arguments that a call to it can't be read without opening the class. new Shipment(43, "Sam", "Pine Rd", "EcoFreight", 2, false, true, "morning", false) hides which value is which, and two swapped true/false values still compile. Named arguments, a builder, or grouping values into an object are common cures.

In a sentence

  • “The long parameter list on the shipment's constructor ended in false, true, "morning", false, and nobody could say which was which.”

Level: Apprentice · More Software Development terms at this level

Updated