Object-oriented design anti-patterns

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
m
Line 1: Line 1:
Object-oriented design anti patterns describe bad design solutions to common problems. As such, they are essentially the opposite of conventional design patterns.
+
Object-oriented design anti-patterns describe bad design solutions to common problems. As such, they are essentially the opposite of conventional design patterns.
  
The following are common object-oriented design anti patterns:
+
The following are common object-oriented design anti-patterns:
  
*[[Anemic Domain Model]] - This anti pattern occurs when data and behavior is separated in the domain model.
+
*[[Anemic Domain Model]] - This anti-pattern occurs when data and behavior is separated in the domain model.
*[[BaseBean]] - This anti pattern occurs when inheritance for implementation is used; that is a class inherits from another class not because it makes sense semantically but because it wants to use methods defined in the superclass.
+
*[[BaseBean]] - This anti-pattern occurs when inheritance for implementation is used; that is a class inherits from another class not because it makes sense semantically but because it wants to use methods defined in the superclass.
*[[Call super]] - This anti pattern occurs when a superclass requires derived classes to call an overridden method.
+
*[[Call super]] - This anti-pattern occurs when a superclass requires derived classes to call an overridden method.
*[[Circle-ellipse problem]] - This anti pattern occurs when inheritance is not used correctly and the [[Liskov substitution principle]] is violated.
+
*[[Circle-ellipse problem]] - This anti-pattern occurs when inheritance is not used correctly and the [[Liskov substitution principle]] is violated.
*[[Circular dependency]] - This anti pattern occurs when there are two or more modules that depend directly or indirectly on each other.
+
*[[Circular dependency]] - This anti-pattern occurs when there are two or more modules that depend directly or indirectly on each other.
*[[Constant interface]]
+
*[[Constant interface]] - This anti-pattern occurs when an interface is used to declare constants but does not contain any methods.
*[[God object]]
+
*[[God object]] - This anti-pattern occurs when an object / class does or knows too much.
*[[Object cesspool]]
+
*[[Object cesspool]] - This anti-pattern occurs when an object pool is used incorrectly in that the state of objects is not reset when they are returned to the pool.
*[[Object orgy]]
+
*[[Object orgy]] - This anti-pattern occurs when objects access each other internals directly rather than going through methods.
 
*[[Poltergeists]]
 
*[[Poltergeists]]
 
*[[Sequential coupling]]
 
*[[Sequential coupling]]
 
*[[Yo-yo problem]]
 
*[[Yo-yo problem]]
  
Many of these anti patterns are closely related to common design maxims.
+
Many of these anti-patterns are closely related to common design maxims.
  
 
==See also==
 
==See also==
 
*[[Design patterns]]
 
*[[Design patterns]]

Revision as of 04:00, 20 July 2009

Object-oriented design anti-patterns describe bad design solutions to common problems. As such, they are essentially the opposite of conventional design patterns.

The following are common object-oriented design anti-patterns:

  • Anemic Domain Model - This anti-pattern occurs when data and behavior is separated in the domain model.
  • BaseBean - This anti-pattern occurs when inheritance for implementation is used; that is a class inherits from another class not because it makes sense semantically but because it wants to use methods defined in the superclass.
  • Call super - This anti-pattern occurs when a superclass requires derived classes to call an overridden method.
  • Circle-ellipse problem - This anti-pattern occurs when inheritance is not used correctly and the Liskov substitution principle is violated.
  • Circular dependency - This anti-pattern occurs when there are two or more modules that depend directly or indirectly on each other.
  • Constant interface - This anti-pattern occurs when an interface is used to declare constants but does not contain any methods.
  • God object - This anti-pattern occurs when an object / class does or knows too much.
  • Object cesspool - This anti-pattern occurs when an object pool is used incorrectly in that the state of objects is not reset when they are returned to the pool.
  • Object orgy - This anti-pattern occurs when objects access each other internals directly rather than going through methods.
  • Poltergeists
  • Sequential coupling
  • Yo-yo problem

Many of these anti-patterns are closely related to common design maxims.

See also

Personal tools