Design maxims

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
(Maxims: add law of leaky abstractions)
Line 1: Line 1:
== Object oriented design maxims ==
+
== Object Oriented Design Maxims ==
  
 
  maxim:: (noun) A general truth or rule of conduct expressed in a sentence.
 
  maxim:: (noun) A general truth or rule of conduct expressed in a sentence.
Line 60: Line 60:
 
* [[You ain't gonna need it]]
 
* [[You ain't gonna need it]]
  
'''Clumps of maxims'''
+
==Clumps of Maxims==
 +
These are groups of Maxims, usually gathered by the developer(s) who proposed them.
  
 
=== [[Johnson and Foote's heuristics]]:===
 
=== [[Johnson and Foote's heuristics]]:===
** [[Recursion introduction]]
+
* [[Recursion introduction]]
** [[Eliminate case analysis]]
+
* [[Eliminate case analysis]]
** [[Reduce the number of arguments]]
+
* [[Reduce the number of arguments]]
** [[Reduce the size of methods]]
+
* [[Reduce the size of methods]]
** [[Class hierarchies should be deep and narrow]]
+
* [[Class hierarchies should be deep and narrow]]
** [[The top of the class hierarchy should be abstract]]
+
* [[The top of the class hierarchy should be abstract]]
** [[Minimize accesses to variables]]
+
* [[Minimize accesses to variables]]
** [[Subclasses should be specializations]]
+
* [[Subclasses should be specializations]]
** [[Split large classes]]
+
* [[Split large classes]]
** [[Factor implementation differences into subcomponents]]
+
* [[Factor implementation differences into subcomponents]]
** [[Separate methods that do not communicate]]
+
* [[Separate methods that do not communicate]]
** [[Send messages to components instead of to self]]
+
* [[Send messages to components instead of to self]]
** [[Reduce implicit parameter passing]]
+
* [[Reduce implicit parameter passing]]
 +
 
 
===[[Riel's heuristics]]===
 
===[[Riel's heuristics]]===
 +
 
===[[Bob Martin's principles]]:===
 
===[[Bob Martin's principles]]:===
** (SRP) The [[Single responsibility principle]]
+
* (SRP) The [[Single responsibility principle]]
** (OCP) The [[Open/closed principle]]
+
* (OCP) The [[Open/closed principle]]
** (LSP) The [[Liskov substitution principle]]
+
* (LSP) The [[Liskov substitution principle]]
** (DIP) The [[Dependency inversion principle]]
+
* (DIP) The [[Dependency inversion principle]]
** (ISP) The [[Interface segregation principle]]
+
* (ISP) The [[Interface segregation principle]]
** (REP) The [[Reuse release equivalence principle]]
+
* (REP) The [[Reuse release equivalence principle]]
** (CCP) The [[Common closure principle]]
+
* (CCP) The [[Common closure principle]]
** (CRP) The [[Common reuse principle]]
+
* (CRP) The [[Common reuse principle]]
** (ADP) The [[Acyclic dependencies principle]]
+
* (ADP) The [[Acyclic dependencies principle]]
** (SDP) The [[Stable dependencies principle]]
+
* (SDP) The [[Stable dependencies principle]]
** (SAP) The [[Stable abstractions principle]]
+
* (SAP) The [[Stable abstractions principle]]
 +
 
 
===[[Ken Auer 1995]]:===
 
===[[Ken Auer 1995]]:===
** [[Define classes by behavior, not state pattern]]  
+
* [[Define classes by behavior, not state pattern]]  
** [[Implement behavior with abstract state pattern]]  
+
* [[Implement behavior with abstract state pattern]]  
** [[Identify message layers pattern]]  
+
* [[Identify message layers pattern]]  
** [[Defer identification of state variables pattern]]  
+
* [[Defer identification of state variables pattern]]  
** [[Encapsulate concrete state pattern]]  
+
* [[Encapsulate concrete state pattern]]  
** [[Use lazy initialization pattern]]  
+
* [[Use lazy initialization pattern]]  
** [[Define default values via explicit protocol pattern]]
+
* [[Define default values via explicit protocol pattern]]
 +
 
 
* Alan Davis 1995:
 
* Alan Davis 1995:
 +
 
===[[Code smells]]:===
 
===[[Code smells]]:===
** [[Duplicate code smell]]
+
* [[Duplicate code smell]]
** [[Long method smell]]
+
* [[Long method smell]]
** [[Large class smell]]
+
* [[Large class smell]]
** [[Long parameter list smell]]
+
* [[Long parameter list smell]]
** [[Divergent change smell]]
+
* [[Divergent change smell]]
** [[Shotgun surgery smell]]
+
* [[Shotgun surgery smell]]
** [[Feature envy smell]]
+
* [[Feature envy smell]]
** [[Data clumps smell]]
+
* [[Data clumps smell]]
** [[Switch statement smell]]
+
* [[Switch statement smell]]
** [[Parallel inheritance hierarchies smell]]
+
* [[Parallel inheritance hierarchies smell]]
** [[Data class smell]]
+
* [[Data class smell]]
** [[Message chain smell]]
+
* [[Message chain smell]]

Revision as of 13:29, 28 July 2009

Contents

Object Oriented Design Maxims

maxim:: (noun) A general truth or rule of conduct expressed in a sentence.

Lets use the term maxim to mean all the rules, laws, guidelines, principles, heuristics, strategies, patterns and idioms that are named by a standard phrase.

Maxims

Clumps of Maxims

These are groups of Maxims, usually gathered by the developer(s) who proposed them.

Johnson and Foote's heuristics:

Riel's heuristics

Bob Martin's principles:

Ken Auer 1995:

  • Alan Davis 1995:

Code smells:

Personal tools