Poltergeists

Short-lived, useless controller classes.

“Classes with very limited roles and effective life cycles.” – Brown et al.

Pop-up classes that appear, do one thing, and vanish.

Signs of Use (Symptoms)

  • Classes named ...Manager or ...Controller to coordinate other classes but have no state.
  • Classes that exist only to invoke a method on another class.
  • Short lifespan objects.

Why it is bad (Consequences)

  • Complexity: Increases class count without adding abstraction value.
  • Confusion: “Why does this LoginStarter class exist? Can’t Login just start?”

Why it happens (Root Cause)

Misunderstanding of controller pattern. Thinking every action needs a class.

When it might be okay (Exceptions)

  • Command Pattern (where the command object is meaningful and serializable).

Explanation

Problem

You have Data and View. You create DataViewConnector strictly to pass data to view once.

The Flaw

The connector is a ghost. It appears, haunts the code, and disappears.

Real world analogy

Hiring a middleman to hand a package from you to your neighbor who is standing right next to you.

Refactoring Solution

  • Inline Class: Move the logic into the invoker or the receiver.
  • Remove Middle Man.

Pros and Cons (of the Antipattern)

Pros (Why people do it) Cons (The price you pay)
  • Separation (misguided)
  • Clutter
  • Unnecessary complexity
  • Comparison

    • Related Antipatterns: Lazy Class, Middle Man.
    • Related Principles: KISS.

    Code example

    Typescript

    Bad (The Antipattern)

    Good (The Fix)

    PHP

    Bad (The Antipattern)

    Good (The Fix)