Poltergeists

Poltergeists
AntiPattern Name: Poltergeists
Also Known As: Gypsy, Proliferation of Classes, and Big DoIt Controller Class
Most Frequent Scale: Application
Refactored Solution Name: Ghostbusting
Refactored Solution Type: Process
Root Causes: Sloth, Ignorance
Unbalanced Force: Management of Functionality, Complexity
Anecdotal Evidence:

“I’m not exactly sure what this class does, but it sure is important!”
Background

When Michael Akroyd presented the Gypsy AntiPattern at Object World West in 1996, he likened the transient appearance and then discrete vanishing of the gypsy class to a “Gypsy

Wagon” that is there one day and gone the next. As we studied Akroyd’s model, we wanted to convey more of the Gypsy’s invoking function in the overall AntiPattern name. Thus, we felt that since poltergeists represent “restless ghosts” that cause “bump-in-the-night types

of phenomena,” that term better represented the “pop in to make something happen” concept of this AntiPattern while retaining the “here now then suddenly vanished” flavor of the initial Gypsy name.

In the LISP language, as in many others, certain pure-evil programmers exist who take great glee in leveraging the “side effects” of certain language functions to mysteriously perform key functionality in their systems. Analysis and understanding of such systems is virtually impossible, and any attempt at reuse is considered insane.

Like the Poltergeist “controller” class, the use of “side effects” to accomplish any principle task in an implementation is an incorrect utilization of the language or architecture tool, and should be avoided.
General Form

Poltergeists are classes with limited responsibilities and roles to play in the system; therefore, their effective life cycle is quite brief. Poltergeists clutter software designs, creating unnecessary abstractions; they are excessively complex, hard to understand, and hard to maintain.

This AntiPattern is typical in cases where designers familiar with process modeling but new to object-oriented design define architectures. In this AntiPattern, it is possible to identify one or more ghostlike apparition classes that appear only briefly to initiate some action in another more permanent class. Akroyd calls these classes “Gypsy Wagons” Typically, Gypsy Wagons are invented as controller classes that exist only to invoke methods of other classes, usually in a predetermined sequence. They are usually obvious because their names are often suffixed by _manager or _controller.

The Poltergeist AntiPattern is usually intentional on the part of some greenhorn architect who doesn’t really understand the object-oriented concept. Poltergeist classes constitute bad design artifacts for three key reasons:
They are unnecessary, so they waste resources every time they “appear.”
They are inefficient because they utilize several redundant navigation paths.
They get in the way of proper object-oriented design by needlessly cluttering the object model.
Symptoms And Consequences
Redundant navigation paths.
Transient associations.
Stateless classes.
Temporary, short-duration objects and classes.
Single-operation classes that exist only to “seed” or “invoke” other classes through temporary associations.
Classes with “control-like” operation names such as start_process_alpha.
Typical Causes
Lack of object-oriented architecture. “The designers don’t know object orientation.”
Incorrect tool for the job.



Poltergeists