1 / 37

Midterm Review CSU 670

This article explores the concept of adaptive programming strategy, which allows for late binding of data structures without changing the program. It introduces the use of DJ classes, such as ClassGraph, Strategy, Visitor, ObjectGraph, and TraversalGraph, to handle data structure details on demand.

Download Presentation

Midterm Review CSU 670

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Midterm Review CSU 670 Spring 2004

  2. AP • Late binding of data structures • Programming without accidental data structure details yet handling all those details on demand without program change

  3. Concepts needed(DJ classes) • ClassGraph • Strategy • Visitor • ObjectGraph • TraversalGraph (efficiency) • ObjectGraphSlice (efficiency)

  4. Adaptive Programming Strategy Bold names refer to DJ classes. is use-case based abstraction of ClassGraph defines family of ObjectGraph

  5. Adaptive Programming Strategy defines traversals of ObjectGraph plus Strategy defines ObjectGraphSlice

  6. Adaptive Programming Strategy guides and informs Visitor

  7. Software Design and Development with DJ (very brief) • Functional decomposition into generic behavior • Decomposition into methods • Decomposition into formal traversal strategies • Decomposition into visitors • Adaptation of generic behavior • Identify class graph • Identify traversal strategies

  8. Definition: Class Graph • A class graph is a directed graph with a partial order on the nodes. We write c1 -> c2 for the edges (construction edges) and c1 <= c2 for the order (inheritance edges -- c1 is a subclass of c2). • We write => for the inverse of <=.

  9. Relations • We think of directed graphs as relations. • Write C(c1,c2) or c1 C c2 for edge from c1 to c2 in C. • Composition of relations by . E.g., x (R.S) z iff there is a y such that xRy and ySz. • R* is the reflective transitive closure of a relation R.

  10. Strategy: From X1 to T o2:X2 o1:X1 declared type of target of e is X3 =>X2 e go down e iff X1 <=.e X3 =>.(<=.C.=>)*.<=) T if only construction edges: go down e iff X1 e X3 C* T

  11. z Strategy S -> T x X1 Y1 Z1 y S X2 Y2 Z2 T t X3 Y3 Z3 x y z t s1:S x31:X3 y31:Y3 z31:Z3 t1:T go down e iff S <=.C X1 =>.(<=.C.=>)*.<=) T

  12. z Strategy S -> T x X1 Y1 Z1 y S X2 Y2 Z2 T t X3 Y3 Z3 x y z t s1:S x31:X3 y31:Y3 z31:Z3 t1:T go down e iff S <=.C X1 =>.(<=.C.=>)*.<=) T

  13. z Strategy S -> T x X1 Y1 Z1 y S X2 Y2 Z2 T t X3 Y3 Z3 x y z t s1:S x31:X3 y31:Y3 z31:Z3 t1:T <=,=> not used go down e iff S <=.C X1 =>.(<=.C.=><=.C.=><=.C=>).<=) T

  14. strategy Example A -> T T -> D a1:A 0..1 :D r1:R X 0..1 B c1:C s1:S D A C s2:S t1:T 0..1 r2:R object graph R S T 0..1 c2:C class graph d2:D go down e iff A <=.C R =>.(<=.C.=>)*.<=) T

  15. S = from BusRoute through Bus to Person Example 2 busStops BusRoute BusStopList buses 0..* NGasPowered BusStop BusList waiting 0..* passengers Bus PersonList Person 0..* DieselPowered

  16. OG : BR BL DP PL P OG’: BR BL B PL P SG : BR B P Example 2 Only node paths shown for space reasons BusList Route1:BusRoute buses busStops :BusStopList Bus15:DieselPowered passengers CentralSquare:BusStop waiting :PersonList :PersonList Joan:Person Paul:Person Seema:Person Eric:Person S = from BusRoute through Bus to Person

  17. OG : BR BL OG’: BR BL SG : BR Example 3 Only node paths shown for space reasons early termination BusList Route1:BusRoute buses busStops :BusStopList Bus15:DieselPowered passengers CentralSquare:BusStop waiting :PersonList :PersonList Joan:Person Paul:Person Seema:Person Eric:Person S = from BusRoute via NGasPoweredto Person

  18. A simple view of traversals • When a traversal reaches a target node in the object graph, the path traversed from the source, with suitable substitution of subclasses by superclasses, must be an expansion of an s-t path in the strategy graph. s is the source and t is the target of the strategy. Each edge in the strategy graph corresponds to at least one edge in the object graph.

  19. A simple view of traversals • When a traversal reaches a final node in the object graph without being at a target, the path traversed from the source, with suitable substitution of subclasses by superclasses, must be a prefix of an expansion of an s-t path in the strategy graph. The prefix is the longest prefix such that there is still a possibility of success as determined by the class graph.

  20. Object Graph Slice • The object graph slice starting with o1 is the slice built by following the edges selected by the path regular expression starting at o1 and continuing until every path terminates (at an object of type t or if it terminates prematurely). go down e iff X1 <=.e X3 =>.(<=.C.=>)*.<=) T

  21. Strategy definition:embedded, positive strategies • Given a graph G, a strategy graph S of G is any subgraph of the transitive closure of G. • The transitive closure of G=(V,E) is the graph G*=(V,E*), where E*={(v,w): there is a path from vertex v to vertex w in G}.

  22. Transitive Closure busStops BusRoute BusStopList buses 0..* BusStop BusList waiting 0..* passengers Bus PersonList Person 0..*

  23. Strategy graph and base graph are directed graphs Key concepts • Strategy graph S with source s and target t of a base graph G. Nodes(S) subset Nodes(G) (Embedded strategy graph). • A path p is an expansion of path p’ if p’ can be obtained by deleting some elements from p.

  24. class dictionaries (11 kinds) inductive nonleft-recursive 9 10 11 8 7 6 1 2 LL(1) 3 4 nonambiguous 5 Venn Diagram AOO / Demeter

  25. Patterns Patterns • Structure-shy Traversal • Selective Visitor • Structure-shy Object • Class Graph • Growth Plan Pattern

  26. instance of Three layers of Demeter defines classes Demeter behavior and aspect files B: metamodel L: model P: user objects CB your behavior and aspect files CL metamodel OB classes model OL TB user object OP a class dictionary for class dictionaries objects TL class dictionary text TP sentence

  27. Icon Demeter Tiling Use as reminder for Demeter Tiling. CB OBCL TBOL TLOP TP

  28. Example ??? Demeter Tiling CB OBCL TBOL TLOP TP Basket aBasket:Basket With respect to the project class dictionary as OB

  29. Example Vertex (or Ident) Demeter Tiling CB OBCL TBOL TLOP TP Basket aBasket:Basket With respect to the project class dictionary as OB

  30. Example ??? Demeter Tiling CB OBCL TBOL TLOP TP Regular_Syntax aRegular_Syntax:Regular_Syntax With respect to the project class dictionary as OB = OL

  31. Example Vertex Demeter Tiling CB OBCL TBOL TLOP TP Regular_Syntax aRegular_Syntax:Regular_Syntax With respect to the project class dictionary as OB = OL

  32. Example ??? Demeter Tiling CB OBCL TBOL TLOP TP Labeled = <label_name> Ident ... <b> With respect to the project class dictionary as OB = OL

  33. Example Adjacency = <source> Vertex ... Demeter Tiling CB OBCL TBOL TLOP TP Labeled = <label_name> Ident ... <b> With respect to the project class dictionary as OB = OL

  34. Example ??? Demeter Tiling CB OBCL TBOL TLOP TP Adjacency = <source> Vertex ... A = <b> B <b> B. With respect to the project class dictionary

  35. Example Adjacency = <source> Vertex ... Demeter Tiling CB OBCL TBOL TLOP TP Adjacency = <source> Vertex ... A = <b> B <b> B. With respect to the project class dictionary

  36. Lightweight Software Development Method • Extreme Programming • lots of testing, write test cases early • incremental development • pair programming

  37. UML • class diagrams • object diagrams

More Related