God object

From CSSEMediaWiki
(Redirected from God class)
Jump to: navigation, search

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