Poltergeist (computer programming)
Appearance
This article needs additional citations for verification. |
In computer programming a poltergeist, or gypsy wagon, is a short lived object used to perform initialization or to invoke methods in another more permanent class.
A poltergeist is an example of an anti-pattern.
The original definition is by Michael Akroyd 1996 - Object World West Conference:
- "As a gypsy wagon or a poltergeist appears and disappears mysteriously, so does this short lived object. As a consequence the code is more difficult to maintain and there is unnecessary resource waste. The typical cause for this antipattern is poor object design."
Gypsy wagons can often be identified by their names. Typically they are stateless "supervision" classes, used only to call methods of other classes, so are often called "manager_" , "controller_", "start_process", etc..
To remove a Gypsy Wagon, delete the class and insert its functionality in the invoked class.