Poltergeist (computer science)
From Wikipedia, the free encyclopedia
This article needs additional citations for verification. Please help improve this article by adding reliable references. Unsourced material may be challenged and removed. (July 2007) |
The neutrality of this article is disputed. Please see the discussion on the talk page.(December 2007) Please do not remove this message until the dispute is resolved. |
In computer programming, a poltergeist (or gypsy wagon) is a short-lived, typically stateless object used to perform initialization or to invoke methods in another, more permanent class. 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."
A poltergeist can often be identified by its name; they are often called "manager_", "controller_", "start_process", etc.
Poltergeists should not be confused with long-lived, state-bearing objects of a pattern such as Model-view-controller, or tier-separating patterns such as Business-Delegate.
To remove a poltergeist, delete the class and insert its functionality in the invoked class, possibly by inheritance or as a mixin.
Poltergeists are examples of an anti-pattern.
[edit] See also
[edit] References
- Brown, William J. (1998). "Chapter 5: Software Development AntiPatterns", AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis. New York, USA: John Wiley & Sons. ISBN 0471197130.