Identify message layers pattern

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
(New page: As an extension to the concept of abstract state messages can be layered. This allows the class to implement even more functionality base...)
 
Line 7: Line 7:
 
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.
 
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===
+
====Watch out for====
 
Be careful not to create circular dependencies, for example consider a class circle  
 
Be careful not to create circular dependencies, for example consider a class circle  
  

Revision as of 01:19, 4 October 2008

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(){
                      getDiamiter() * 2;
        }
       
       public double getDiamiter(){
                     return GetRadius()/2;
         }
} 

Watch out for creating overly complex and inefficient code.

Personal tools