Remove Parameter

A parameter is no longer used by the method body.

“A parameter is no longer used by the method body.”

Clean up unused inputs.

graph LR
    A[func(arg)] -->|Refactoring| B[func()]

When to apply (Smells)

  • Dead Code: Params that aren’t used.
  • Speculative Generality: “We might need this later”.

Motivation

  • Simplicity: Shorter signatures are easier to read and use.

Mechanics (Steps)

  1. Check the method strictly doesn’t use the param.
  2. Remove it from signature.
  3. Update callers.

Explanation

Problem

Method calculate(date) doesn’t use date.

Solution

Change to calculate().

Pros and Cons

Pros Cons
  • Clarity
  • None
  • Code example

    Typescript

    Before

    After

    PHP

    Before

    After