motivation motivation programming by example programming
play

Motivation: Motivation: Programming By Example Programming By - PDF document

Foundations and Applications of Graph Foundations and Applications of Graph Transformation Transformation An introduction from a software engineering perspective An introduction from a software engineering perspective Luciano Baresi Luciano


  1. Foundations and Applications of Graph Foundations and Applications of Graph Transformation Transformation An introduction from a software engineering perspective An introduction from a software engineering perspective Luciano Baresi Luciano Baresi Politecnico Politecnico di Milano di Milano Politecnico di Milano Politecnico di Milano Reiko Heckel Reiko Heckel Universität Universität University of Paderborn University of Paderborn Paderborn Paderborn Motivation: Motivation: Programming By Example Programming By Example StageCast ( (www.stagecast.com www.stagecast.com): a visual programming ): a visual programming StageCast environment for kids (from 8 years on), based on environment for kids (from 8 years on), based on � behavioural rules associated to graphical objects behavioural rules associated to graphical objects � � visual pattern matching visual pattern matching � � simple internal control structures (priority, sequence, non simple internal control structures (priority, sequence, non- - � determinism, ...) determinism, ...) � external external keybord keybord control control � � Rule Rule- -based behaviour modelling is a natural and based behaviour modelling is a natural and � intuitive paradigm! intuitive paradigm! Example: A simple A simple PacMan PacMan game; concrete ( game; concrete (StageCast StageCast) ) Example: vs. abstract (graph- -based) presentation. based) presentation. vs. abstract (graph 2 2 L. Baresi and R. Heckel L. Baresi and R. Heckel - - ICGT Tutorial (Barcelona, Spain 08/10/2002) ICGT Tutorial (Barcelona, Spain 08/10/2002)

  2. States of the PacMan PacMan Game: Game: States of the Graph Graph- -Based Presentation Based Presentation :Ghost :Field :Field instance graph :PacMan (represents a marbles=3 :Field :Field :Field single state; abstracts from :Marble spatial layout) :Field typing typing PacMan Ghost Field type graph marbles:int (specifies legal instance graphs Marble � state space) 3 3 L. Baresi and R. Heckel - L. Baresi and R. Heckel - ICGT Tutorial (Barcelona, Spain 08/10/2002) ICGT Tutorial (Barcelona, Spain 08/10/2002) Rules of the Rules of the PacMan PacMan Game: Game: Graph- -Based Presentation Based Presentation Graph pm:PacMan pm:PacMan movePM f1:Field f2:Field f1:Field f2:Field pm:PacMan pm:PacMan :Marble marbles=m collect marbles=m+1 f1:Field f2:Field f1:Field f2:Field g:Ghost :PacMan g:Ghost kill f1:Field f2:Field f1:Field f2:Field 4 4 L. Baresi and R. Heckel L. Baresi and R. Heckel - - ICGT Tutorial (Barcelona, Spain 08/10/2002) ICGT Tutorial (Barcelona, Spain 08/10/2002)

  3. Outline Outline � Motivations Motivations � � Foundations Foundations � � Sample Sample applications applications � � Tool Tool support support � � Conclusions Conclusions � 5 5 L. Baresi and R. Heckel L. Baresi and R. Heckel - - ICGT Tutorial (Barcelona, Spain 08/10/2002) ICGT Tutorial (Barcelona, Spain 08/10/2002) 1- - Motivations Motivations 1 Why you are here. Why you are here.

  4. Visual Modeling Modeling Techniques Techniques Visual Petri nets Petri nets p1 t3 t1 p2 t0 Media Media t2 p3 Function Block Continuous Continuous Discrete Discrete Media Media Media Media Structured Structured Analysis Analysis Diagrams ON_TMR TON Audio Audio Animation Animation Video Video IN Q IN DB_FF PT ET SR OFF_TMR S1 Q1 OUT Graphics Graphics Image Text Image Text TON R Class Diagrams (UML) IN Q DB_TIME PT ET 7 7 L. Baresi and R. Heckel - L. Baresi and R. Heckel - ICGT Tutorial (Barcelona, Spain 08/10/2002) ICGT Tutorial (Barcelona, Spain 08/10/2002) Separation of Concerns Separation of Concerns � Complexity requires abstractions. Models Complexity requires abstractions. Models � allow to focus separately on: allow to focus separately on: Problem System parts System parts � � domain � class, component, subsystem class, component, subsystem � aspects aspects � � � data, function, distribution, security data, function, distribution, security � user views user views � � � clerk, customer, system administrator clerk, customer, system administrator � Model abstraction levels abstraction levels � � � requirements, design, … requirements, design, … � � Black Black- - vs. white vs. white- -box box � � Development processes Development processes � human- human -oriented ( oriented ( � � visual) visual) � � Implementation incomplete and redundant incomplete and redundant � � 8 8 L. Baresi and R. Heckel - L. Baresi and R. Heckel - ICGT Tutorial (Barcelona, Spain 08/10/2002) ICGT Tutorial (Barcelona, Spain 08/10/2002)

  5. Integration and Consistency Integration and Consistency Req. A Req. B capture Viewpoint A Viewpoint B ensure consistency Model A Model B integrate & transform Make sure there is an implementation System satisfying all requirements ! 9 9 L. Baresi and R. Heckel L. Baresi and R. Heckel - - ICGT Tutorial (Barcelona, Spain 08/10/2002) ICGT Tutorial (Barcelona, Spain 08/10/2002) What do we need? What do we need? � Concepts Concepts, , theory theory and and tools tools � Concrete syntax syntax like like for for textual textual programming programming Concrete Concrete syntax languages languages syntax syntax scanning and layout � � semantics semantics parsing operational � � � denotational denotational � semantics � operationa operationa � transformation transformation / / refinement refinement Abstract syntax Abstract syntax � � Abstract syntax verification verification � � … … � � denotational semantic semantics feedback � GT at two levels GT at two levels � rule rule- -based behaviour based behaviour � � modelling modelling Semantic domain/ Semantic domain/ Semantic domain/ meta modelling meta modelling � � Programming language Programming language Programming language 10 10 L. Baresi and R. Heckel - L. Baresi and R. Heckel - ICGT Tutorial (Barcelona, Spain 08/10/2002) ICGT Tutorial (Barcelona, Spain 08/10/2002)

  6. 2- - Foundations of Foundations of 2 Graph Transformation Graph Transformation How it works. How it works. Outline Outline � Roots and Sources Roots and Sources � � Where it all came from and who invented it. Where it all came from and who invented it. � � A Basic Formalism A Basic Formalism � � Light Light- -weight presentation of a categorical approach. weight presentation of a categorical approach. � � Variations and Extensions Variations and Extensions � � Syntactic and semantic alternatives, and advanced features. Syntactic and semantic alternatives, and advanced features. � � Relation with Classic Rewriting Techniques Relation with Classic Rewriting Techniques � � Inspiration for application and theory. Inspiration for application and theory. � 12 12 L. Baresi and R. Heckel L. Baresi and R. Heckel - - ICGT Tutorial (Barcelona, Spain 08/10/2002) ICGT Tutorial (Barcelona, Spain 08/10/2002)

  7. Roots and Sources Roots and Sources Chomsky Term Petri Grammars Rewriting Nets Graph Transformation and Graph Grammars (Web grammars: Pfaltz, Rosenfeld 68; Montanari 69) (Grammars for partial orders: Schneider 70) ( λ -graph reduction: Wadsworth 71) Node label-controlled Algebraic double- graph grammars pushout approach [NLC] [DPO] Monadic 2nd Order PROgrammed Graph Logic of Graphs REwriting Systems [MSO] [PROGRES] 13 13 L. Baresi and R. Heckel - L. Baresi and R. Heckel - ICGT Tutorial (Barcelona, Spain 08/10/2002) ICGT Tutorial (Barcelona, Spain 08/10/2002) A Basic Approach: A Basic Approach: Typed Graphs Typed Graphs � Graphs as algebraic structures Graphs as algebraic structures � G = (V, E, src src, tar) , tar) with src src, tar: E , tar: E � � V V G = (V, E, with � Graph homomorphism Graph homomorphism as pair of mappings as pair of mappings � h = ( h = (h h V V : V : V 1 � V V 1 1 , , h h E E : E : E 1 � E E 2 2 ) : G ) : G 1 � G G 2 1 � 1 � 1 � 2 preserving the graph structure preserving the graph structure � Typed graphs Typed graphs (cf. PacMan example) � � fixed type graph fixed type graph TG TG � � instance graphs instance graphs (G, g : G (G, g : G � � TG) TG) typed over typed over TG TG � � UML UML- -like notation like notation x : t x : t for x for x in in G G with with g(x) = t g(x) = t � 14 14 L. Baresi and R. Heckel L. Baresi and R. Heckel - - ICGT Tutorial (Barcelona, Spain 08/10/2002) ICGT Tutorial (Barcelona, Spain 08/10/2002)

Recommend


More recommend