1 / 48

Tools Project

Tools Project. COM 1205. The 5 tasks. Each class must be defined in the class dictionary or must be imported. No inheritance cycle. Parts must be unique. Single inheritance. Terminal Buffer Rule. Extreme programming. Important feature: Write test cases early. Parts must be unique.

juanfuller
Télécharger la présentation

Tools Project

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. Tools Project COM 1205 Project Help

  2. The 5 tasks • Each class must be defined in the class dictionary or must be imported. • No inheritance cycle. • Parts must be unique. • Single inheritance. • Terminal Buffer Rule. Project Help

  3. Extreme programming • Important feature: • Write test cases early. Project Help

  4. Parts must be unique A = <b> B <b> C. B = . C = . A : J | K common <b> B. J = <b> C. K = . Reduce second case to first case by flattening. Use above examples as test cases. Project Help

  5. Parts must be unique:Reduction A : J | K common <b> B. J = <b> C. K = . Flattened: A : J | K. J = <b> C <b> B. K = <b> B. Project Help

  6. Add additional task 6: Flatten Test case A : J | K common <b> B. J = <b> C. K = . Flattened: A : J | K. J = <b> C <b> B. K = <b> B. Project Help

  7. Is Flatten useful elsewhere? Test case A : J | K common <b> B. J = <b1> C. K = String. Flattened: A : J | K. J = <b1> C <b> B. K = String <b> B. Project Help

  8. Is Flatten useful elsewhere? Test case A : J | K common <b> B. J = <b> C. K = String. Flattened: A : J | K. J = <b> C <b> B. K = String <b> B. Terminal Buffer Rule Project Help

  9. Parts must be unique • Delay flatten implementation and assume input is flat. We want to get a program running soon. • Phase 1: Implement “Parts must be unique” (PU) for flat class graphs with construction and alternation nodes and edges. Project Help

  10. Parts must be unique • Which problem must be solved? • Find duplicates in a Java list. Search on google.com brought me to a book by John Zukowski: Mastering Java. He is a Northeastern CCS undergraduate alumnus. He describes that the set interface eliminates duplicates. His book is featured on the SUN site. Project Help

  11. Parts must be unique • Proposal: add all the label elements of a class definition to a set and check if the set already contains each element. If so, have a violation. • Need an efficient imlementation of a set: HashSet: offers constant time performance for add and contains. Project Help

  12. Some useful code • Set partNames = new HashSet(); • partNames.contains(aName); • partNames.add(aName); Project Help

  13. Design for computing flattened class graph • compute_parts(TraversalGraph CA) • for each concrete class • find list of super classes • append parts of super classes to immediate parts • eliminate all parts from abstract classes. Project Help

  14. Finding Superclasses • add auxiliary edges to class graph. • set them with one traversal. Project Help

  15. Context Switch Project Help

  16. XML Schema Evolution Write XMLized cds without any syntax. Rules for XMLizing: construction class A=… . to A=“<A>”…”</A>”. Motivation: instead of writing the program that translates, we write two class dictionaries or we even automatically generate them. Project Help

  17. Approach object-equivalent same order • XMLCD1, XMLCD2, LL1CD1, LL1CD2 • LL1CD1 sublanguage of LL1CD2 • Algorithm: Input: s1 Output: s3 • o1 = Read(s1, XMLCD1) • s2 = Print(o1, LL1CD1) • o2 = Read(s2, LL1CD2) • s3 = Print(o2, XMLCD2) Project Help

  18. Approach: Preprocessing • XMLS1, XMLS2 • Translate XMLS1 to XMLCD1 so that language is “preserved”. • Translate XMLS2 to XMLCD2 so that language is “preserved”. • ok. to have a slight change to documents Project Help

  19. Slight Change <P> here we have any text </P> <P> (@ here we have any text @) </P> Cd: SomeClass = “<P>” Text </P>. Text is a terminal class like Ident defined in edu.neu.ccs.demeter Project Help

  20. L1: A = B C. B : D | E common F. L2: A = X [Y] C. X = B [Z]. B : U | E | G common V [Z]. U = D. V = F. D = [A]. A class X not defined : X = . Ex 1:Consider two XMLized cds Project Help

  21. L1: A = B C. B : D | E common F. L2: A = X [Y] C. X = B [Z]. B : U | E | G common V [Z]. U = D. V = F. D = [“a” A]. A class X not defined : X = “x”. L1 sublanguage L2 UnXMLize cds to avoid left recursion A X B U D A Project Help

  22. lec7:90 class dictionaries (11 kinds) inductive nonleft-recursive 9 10 11 8 7 6 1 2 LL(1) 3 4 nonambiguous 5 Venn Diagram Project Help

  23. L1: binary expressions E : S | C. S = int. C = Op <a1> E <a2> E. Op : A | M. L2: n-ary expressions E : S | C. S = int. C = Op <as> Es. Es = List(E). List(S) ~ {S}. Op : A | M. A class X not defined : X = . Ex 2: Two XMLized cds Project Help

  24. L1: binary expressions E : S | C. S = int. C = Op “(“ <a1> E <a2> E”)”. Op : A | M. L2: n-ary expressions E : S | C. S = int. C = “(“Op <as> Es “)”. Es = List(E). List(S) ~ “(“ {S} “)”. Op : A | M. L1 a sublanguage of L2 A class X not defined : X = “x”. Ex 2: UnXMLized cds Project Help

  25. Conjecture • Can we make both cds LL(1) by using A = [B]. -> A = [“bB” B “eB”]. A ~ {S}. -> A ~ “bA” {“bS” S “eS”} “eA”. Project Help

  26. DJ partial evaluation cg.fetch(o, “from A via B to C”) -> o.get_x1().get_x2().get_x3(). … cg.traverse … generate code in a similar way as DemeterJ does. Project Help

  27. Context switch • Multi-layer architecture similar to Demeter’s architecture. Project Help

  28. UML language architecture • UML metamodel defines meaning of UML models • Defined in a metacircular manner, using a subset of UML to specify itself • UML metamodel bootstraps itself. Similar: • compiler compiles itself • grammar defines itself • class dictionary defines itself Project Help

  29. 4 layer metamodel architecture • UML metamodel one of the layers • Why four layers? • Proven architecture for complex models • Validates core constructs by using them to define themselves Project Help

  30. Four layer architecture • meta-metamodel • language for specifying metamodels • metamodel • language for specifying models • model • language for specifying objects in some domain • user objects Project Help

  31. Four levels • User Objects in running system • check run-time constraints • Model of System under design • specify run-time constraints • Meta-model • specify constraints on use of constructs in model • Meta-metamodel • data interchange between modeling tools Project Help

  32. 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 Project Help

  33. Icon Demeter Tiling Use as reminder for Demeter Tiling. CB OBCL TBOL TLOP TP Project Help

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

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

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

  37. 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 Project Help

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

  39. 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 Project Help

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

  41. 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 Project Help

  42. Strategy: From C1 to T o2:C2 o1:C1 declared type of o2 is C3=>C2 e go down e iff C1 <=.C C2 (=>.<=.C.=>)*.<=) T go down e iff C1 EI* EC C2 (EA*(EI* EC EA*)* EI*) T Project Help

  43. go down e iff C1 <=.C C2 (=>.<=.C.=>)*.<=) T Example 1 strategy: {A -> B B -> C} Object graph Strategy s t :A A B C x1:X class graph S e1:Empty :R R A x2:X Empty B x c x c1:C X b c2:C BOpt c c3:C C Project Help

  44. Agenda: Add to DJ • Add WandVisitor as a new subclass to Visitor. • In a WandVisitor visitor method activation is delayed until we are at a target. • What are the semantics? Project Help

  45. WandVisitor example // where has source A and target C void someMethod(TraversalGraph where) { where.traverse(this, new WandVisitor(“A”,”C”) { void before(A a){print(a);} void before(B b){print(b);} void before(C c){print(c);} }); } Which methods will be executed when a C-object is visited? Not all As and Bs visited since last visit to a C-object? Project Help

  46. Nov. 20, 2000 • Fail fast or multiple error messages? • Better several error messages. • Inheritance cycle checking. Is greatly simplified if we assume single inheritance. Project Help

  47. Buffer Rules • Many problems of software engineering can be solved by another layer of indirection. Project Help

  48. Applications of Traversal Strategies • Program Kinds in DJ • AdaptiveProgramTraditional(ClassGraph) • strategies are part of program: DemeterJ, Demeter/C++ • AdaptiveProgramDynamic(Strategies, ClassGraph) • strategies are a parameter. Even more adaptive. • AdaptiveProgram DJ_Typical (TraversalGraphs) • strategies are a parameter. Reuse traversal graphs. • AdaptiveProgramDJ(ObjectGraphSlices) • strategies are a parameter. Reuse traversal graph slices. Project Help

More Related