Hi Mira: do you think it is useful to present APPCs in pattern form? Here is a start. Should we put the full pattern on the web? -- Karl =========== Name APPC Pattern: Architectural Pattern Synonyms APPC/Personality/AOP Pattern Intent Describe popular behavior or behavior modifications in terms of an idealized class structure and independent of concrete class structure, using traversal strategy graphs and visitors as appropriate. Map idealized class structure to concrete class structure using traversal strategy graphs as appropriate. Define the skeleton of an algorithm or a role or a behavior modification deferring some steps to abstract methods. Turn popular behaviors or behavior modifications on and off dynamically. Motivation Have an encapsulated unit for behavioral abstraction for new behavior and modified behavior covering multiple classes. Concrete class structures are overworked and to favor reusability each behavior should be expressed in terms of an idealized class structure that is mapped flexibly into a concrete class structure. This not only favors reusability, but it also makes programs simpler. Distinguish between "IS-A" and "PLAYS-THE-ROLE-OF" relationships. Applicability Use to implement popular behaviors and behavior modifications. Whenever you have a class hierarchy (IS-A) and a behavior assignment to classes (PLAYS-THE-ROLE-OF) so that the IS-A structure cross-cuts the behavior assignment. Structure class graph interface class graph expansion strategy graph A personality has local data and functions and a constructor and an upstream and downstream interface. An APPC provides an implementation for a set of functions (the upstream interface) that modify classes that implement the downstream interface of the personality. ... Implementation Use interfaces and egos? For implementation of downstream interface: XYZ get_single_xyz(){ // edge mapping implemented by strategy return XYZ(long_get("strategy to XYZ")); // traverse to XYZ and return the XYZ-object // single path constraint } // long_get is attached to Object // Object long_get(String strategy); // returns Target(strategy)-object // reachable from Source(strategy)-object XYZ_Vector get_multiple_xyz(){ // edge mapping implemented by strategy return XYZ_Vector(collect("strategy to XYZ")); // traverse to XYZ and return all the XYZ-objects } // collect is attached to Object // Object collect(String strategy); // returns all Target(strategy)-objects reachable // from Source(strategy)-object TRAV.trav(o, "strategy", vector of visitors); trav is a static method of TRAV class: Object trav(Vector o, String strategy, Vector v); Object trav(o, String strategy, Vector[] v); returns object returned by first visitor