Identify message layers pattern

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
m
Line 1: Line 1:
 +
This axiom is contained in [[PLoP 1995|Pattern Languages of Program Design]] and republished in [[Ken Auer 1995]].
 +
 
As an extension to the concept of [[Implement behavior with abstract state pattern|abstract state]], messages can be layered. This allows the class to implement even more functionality based on the already available behaviour in the class.  
 
As an extension to the concept of [[Implement behavior with abstract state pattern|abstract state]], messages can be layered. This allows the class to implement even more functionality based on the already available behaviour in the class.  
  
Line 23: Line 25:
  
 
== See also ==
 
== See also ==
* [[Ken Auer 1995]]
+
*[[Ken Auer]]

Revision as of 06:53, 18 October 2010

This axiom is contained in Pattern Languages of Program Design and republished in Ken Auer 1995.

As an extension to the concept of abstract state, messages can be layered. This allows the class to implement even more functionality based on the already available behaviour in the class.

What to do

"Identify a small subset of the abstract state and behavoiur methods which all other methods can rely on as kernel methods"

Identify methods that can be implemented by referring to these methods and using these methods minimise the amount of concrete state that your class requires.

Watch out for

Be careful not to create circular dependencies; for example, consider a class circle:

public class circle{

       public double getRadius(){
                      return getDiameter() * 2;
        }
       
       public double getDiameter(){
                     return GetRadius()/2;
         }
} 

Watch out for creating overly complex and inefficient code.

See also

Personal tools