God object

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
(Created page about god object anti pattern)
 
m (Reverted edits by Ebybymic (Talk); changed back to last version by Matthew Harward)
 
(5 intermediate revisions by 4 users not shown)
Line 4: Line 4:
  
 
Nevertheless, god objects are sometimes used in domains where performance is more important than maintainability, including in hardware and micro controller programming.
 
Nevertheless, god objects are sometimes used in domains where performance is more important than maintainability, including in hardware and micro controller programming.
 +
 +
== Also Known As ==
 +
* God class
 +
* God object
 +
* The Blob
 +
* Winnebago
 +
* Supernova (New God Class - Software Evolution Metaphor)
 +
* Red Giant (Permanent God Class - Software Evolution Metaphor)
  
 
==Liabilities==
 
==Liabilities==
Line 14: Line 22:
 
*[[Model the real world]]
 
*[[Model the real world]]
 
*[[One key abstraction]]
 
*[[One key abstraction]]
 +
*[[Avoid god classes]]
 +
*[[Split large classes]]
 +
 +
{{Design Anti-patterns}}
 +
[[Category: Anti-Patterns]]

Latest revision as of 03:10, 25 November 2010

God object is an anti pattern that occurs when one class / object is knows or does too much. God objects (or classes) contain a lot of functionality and fulfill more than one responsibility. They should be split up into several objects / classes.

God objects conflict with the object oriented paradigm because they don't really represent a single domain entity but usually consist of a number of different domain concepts all combined into one massive object. Such a practice greatly compromises the maintainability and understandability of code.

Nevertheless, god objects are sometimes used in domains where performance is more important than maintainability, including in hardware and micro controller programming.

Also Known As

  • God class
  • God object
  • The Blob
  • Winnebago
  • Supernova (New God Class - Software Evolution Metaphor)
  • Red Giant (Permanent God Class - Software Evolution Metaphor)

Liabilities

  • God objects make maintenance very difficult because the god object is referenced so much in other code that making changes to it has widespread effects on the rest of the system.
  • God objects make a system harder to understand because the task performed by the object is unclear and there is usually a lot of code in god classes.

Related design heuristics


Personal tools