Design maxims

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
m
m (Reverted edits by Ebybymic (Talk); changed back to last version by LukeRobinson)
 
(30 intermediate revisions by 13 users not shown)
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.
  
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.
+
Let's use the term ''maxim'' to mean all the rules, laws, guidelines, principles, heuristics, strategies, patterns and idioms that are named by a standard phrase.
 +
 
 +
[[Maxim Hierarchy]] - An attempt at creating a hierarchy of maxims can be found here.
  
 
=== Maxims ===
 
=== Maxims ===
Line 18: Line 20:
 
* [[Common reuse principle]]
 
* [[Common reuse principle]]
 
* [[Coupling and cohesion]]
 
* [[Coupling and cohesion]]
 +
* [[Dependency injection]]
 
* [[Dependency inversion principle]]
 
* [[Dependency inversion principle]]
 
* [[Design by contract]]
 
* [[Design by contract]]
Line 27: Line 30:
 
* [[Encapsulation is hierarchical]]
 
* [[Encapsulation is hierarchical]]
 
* [[Encapsulation boundary]]
 
* [[Encapsulation boundary]]
 +
* [[Establishing priorities]]
 
* [[Fat interfaces]]
 
* [[Fat interfaces]]
 
* [[Favor composition over inheritance]]
 
* [[Favor composition over inheritance]]
Line 34: Line 38:
 
* [[Impedance mismatch]]
 
* [[Impedance mismatch]]
 
* [[Information hiding]]
 
* [[Information hiding]]
 +
* [[Intelligent children pattern]]
 
* [[Interface segregation principle]]
 
* [[Interface segregation principle]]
 
* [[Keep accessors and mutators separate]]
 
* [[Keep accessors and mutators separate]]
 
* [[Keep it simple]]
 
* [[Keep it simple]]
 
* [[Law of Demeter]]
 
* [[Law of Demeter]]
 +
* [[Law of leaky abstractions]]
 
* [[Liskov substitution principle]]
 
* [[Liskov substitution principle]]
 
* [[Model the real world]]
 
* [[Model the real world]]
Line 43: Line 49:
 
* [[No concrete base classes]]
 
* [[No concrete base classes]]
 
* [[No silver bullet]]
 
* [[No silver bullet]]
 +
* [[Once and only once]]
 
* [[One responsibility rule]]
 
* [[One responsibility rule]]
 
* [[Open closed principle]]
 
* [[Open closed principle]]
* [[Once and only once]]
+
* [[Option-operand separation]]
 
* [[Premature optimization]]
 
* [[Premature optimization]]
 
* [[Program to the interface not the implementation]]
 
* [[Program to the interface not the implementation]]
Line 59: Line 66:
 
* [[You ain't gonna need it]]
 
* [[You ain't gonna need it]]
  
'''Clumps of maxims'''
+
==Clumps of Maxims==
* [[Johnson and Foote's heuristics]]:
+
These are groups of Maxims, usually gathered by the developer(s) who proposed them.
** [[Recursion introduction]]
+
 
** [[Eliminate case analysis]]
+
===COSC 427's:===
** [[Reduce the number of arguments]]
+
* [[Make constructors blocking]]
** [[Reduce the size of methods]]
+
* [[No Peter Pan objects]]
** [[Class hierarchies should be deep and narrow]]
+
* [[Avoid mixing inputs and outputs]]
** [[The top of the class hierarchy should be abstract]]
+
 
** [[Minimize accesses to variables]]
+
=== [[Johnson and Foote's heuristics]]:===
** [[Subclasses should be specializations]]
+
* [[Recursion introduction]]
** [[Split large classes]]
+
* [[Eliminate case analysis]]
** [[Factor implementation differences into subcomponents]]
+
* [[Reduce the number of arguments]]
** [[Separate methods that do not communicate]]
+
* [[Reduce the size of methods]]
** [[Send messages to components instead of to self]]
+
* [[Class hierarchies should be deep and narrow]]
** [[Reduce implicit parameter passing]]
+
* [[The top of the class hierarchy should be abstract]]
* [[Riel's heuristics]]
+
* [[Minimize accesses to variables]]
* [[Bob Martin's principles]]:
+
* [[Subclasses should be specializations]]
** (SRP) The [[Single responsibility principle]]
+
* [[Split large classes]]
** (OCP) The [[Open/closed principle]]
+
* [[Factor implementation differences into subcomponents]]
** (LSP) The [[Liskov substitution principle]]
+
* [[Separate methods that do not communicate]]
** (DIP) The [[Dependency inversion principle]]
+
* [[Send messages to components instead of to self]]
** (ISP) The [[Interface segregation principle]]
+
* [[Reduce implicit parameter passing]]
** (REP) The [[Reuse release equivalence principle]]
+
 
** (CCP) The [[Common closure principle]]
+
===[[Riel's heuristics]]:===
** (CRP) The [[Common reuse principle]]
+
* All of Riel's heuristics can be found [[Riel's heuristics|here]].
** (ADP) The [[Acyclic dependencies principle]]
+
 
** (SDP) The [[Stable dependencies principle]]
+
===[[Bob Martin's principles]]:===
** (SAP) The [[Stable abstractions principle]]
+
* (SRP) The [[Single responsibility principle]]
* KenAuer1995:
+
* (OCP) The [[Open/closed principle]]
** DefineClassesByBehaviorNotStatePattern.
+
* (LSP) The [[Liskov substitution principle]]
** ImplementBehaviorWithAbstractStatePattern.
+
* (DIP) The [[Dependency inversion principle]]
** IdentifyMessageLayersPattern.
+
* (ISP) The [[Interface segregation principle]]
** DeferIdentificationOfStateVariablesPattern.  
+
* (REP) The [[Reuse release equivalence principle]]
** EncapsulateConcreteStatePattern.
+
* (CCP) The [[Common closure principle]]
** UseLazyInitializationPattern.
+
* (CRP) The [[Common reuse principle]]
** DefineDefaultValuesViaExplicitProtocolPattern.
+
* (ADP) The [[Acyclic dependencies principle]]
* AlanDavis1995:
+
* (SDP) The [[Stable dependencies principle]]
 +
* (SAP) The [[Stable abstractions principle]]
 +
 
 +
===[[Ken Auer 1995]]:===
 +
* [[Define classes by behavior, not state pattern]]
 +
* [[Implement behavior with abstract state pattern]]
 +
* [[Identify message layers pattern]]
 +
* [[Defer identification of state variables pattern]]
 +
* [[Encapsulate concrete state pattern]]
 +
* [[Use lazy initialization pattern]]
 +
* [[Define default values via explicit protocol pattern]]
 +
 
 +
===[[Alan Davis 1995]]:===
 +
To be completed...
 +
 
 +
===[[William Brown 1998]]:===
 +
* [[Managing functionality]]
 +
* [[Managing performance]]
 +
* [[Managing complexity]]
 +
* [[Managing change]]
 +
* [[Managing IT resources]]
 +
* [[Managing technology transfer]]
 +
 
 +
===[[Joshua Bloch]]:===
 +
* [[Joshua Bloch 2006 Bumper Sticker API Design | Bumper Sticker API Design]]
 +
 
 +
== See Also ==
 
* [[Code smells]]
 
* [[Code smells]]
 +
* [[Patterns]]
 +
* [http://programmer.97things.oreilly.com/wiki/index.php/Edited_Contributions Edited Contributions] - A whole heap of maxims and ideas...

Latest revision as of 03:08, 25 November 2010

Contents

Object Oriented Design Maxims

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

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

Maxim Hierarchy - An attempt at creating a hierarchy of maxims can be found here.

Maxims

Clumps of Maxims

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

COSC 427's:

Johnson and Foote's heuristics:

Riel's heuristics:

  • All of Riel's heuristics can be found here.

Bob Martin's principles:

Ken Auer 1995:

Alan Davis 1995:

To be completed...

William Brown 1998:

Joshua Bloch:

See Also

Personal tools