Table of Contents

Long Parameter List

Alternative Names

Context

Problem Statement

A method has a lot of parameters.

Description

Causes

Origin

Disadvantages

Advantages

Refactorings

Anti-Pattern Collections

Examples

Example 1: CreateProcess and how it is avoided

The Windows API function CreateProcess takes ten arguments most of which are even optional. The function is cumbersome to use and hard to read because of the large number of parameters. Developers tend to avoid the use of the function and use simpler ones like ShellExecute (which still has six parameters) instead, or write wrapper functions for it. Some might be even tempted to use WinExec which is very easy to use but deprecated. In contrast to that the .NET method Process.Start can often be called with just one parameter.

Description Status

Incomplete

Further Reading

Discussion

Discuss this wiki article and the anti-pattern on the corresponding talk page.