Course contentsShow
← Software Engineering
Lesson 338 of 1,93310. RefactoringFree lesson

Bloaters: Long Parameter List

Detecting methods with too many parameters that indicate missing abstractions or poor object decomposition.

Bloaters: Long Parameter List

What you'll learn: How to spot methods with too many parameters and why they signal missing abstractions or poor object design.


The Problem with Long Parameter Lists

A Long Parameter List occurs when a method accepts many parameters (often more than 3-4), making it difficult to understand, call correctly, and maintain. This smell suggests that related data hasn't been properly grouped into cohesive objects, or that the method is trying to do too much.

Think of it like ordering at a restaurant by listing every ingredient separately: "I'll have wheat, yeast, tomatoes, mozzarella, basil, olive oil..." instead of simply saying "I'll have a margherita pizza." The individual ingredients exist, but they naturally belong together as a concept.

Why It's a Problem

Long parameter lists create several issues:

  • Hard to remember: Callers must recall the correct order and meaning of each parameter
  • Easy to confuse: Similar types (multiple strings or numbers) increase the chance of passing arguments in the wrong order
  • Rigid and brittle: Adding new parameters forces changes everywhere the method is called
  • Missing abstraction: The parameters often represent data that should logically be grouped

What to Look For

You have a Long Parameter List smell when:

  • A method takes more than 3-4 parameters
  • Several parameters are always passed together
  • Parameters represent attributes of a single concept
  • You struggle to remember what each parameter means without checking the signature

Key Takeaway: Long Parameter Lists indicate that related data should be grouped into objects. When a method needs many pieces of information, it's usually a sign you're missing a useful abstraction that bundles that data together meaningfully.