26 data oriented design methods
play

26. Data-Oriented Design Methods 1) Jackson Structured Programming - PowerPoint PPT Presentation

Fakultt Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie Prof. Amann - Softwaretechnologie II 26. Data-Oriented Design Methods 1) Jackson Structured Programming (JSP) and Jackson Structured Diagrams (JSD)


  1. Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie – Prof. Aßmann - Softwaretechnologie II 26. Data-Oriented Design Methods 1) Jackson Structured Programming (JSP) and Jackson Structured Diagrams (JSD) Prof. Dr. U. Aßmann 2) Grammar-Driven Programming Technische Universität Dresden Institut für Software- und 3) Extensibility of JSP and Grammar-Based Multimediatechnik Applications http://st.inf.tu-dresden.de/teaching/swt2 Version 16-0.3, 1/14/17

  2. Obligatory Reading S o f t w a r e t e c h n o l o g i e I I G h e z z i C h . 3 . 3 , 4 . 1 - 4 , 5 . 5 ● Pfmeeger Ch. 4.1-4.4, 5 ● M. Jackson. The Jackson Development Methods. Wiley Encyclopedia of Software ● Engineering. J. Marciniak (ed.), 1992 h t t p : / / w w w . j a c k s o n w o r k b e n c h . c o . u k / s t e v e f e r g s p a g e s / – jackson_methods/index.html http://www.ferg.org%2Fpapers%2Fjackson—the_jackson_development_methods.pdf – – Non-obligatory literature: ● P. Klint, R. Lämmel, and C. Verhoef. Toward an engineering discipline for grammarware. ACM – Transactions on Software Engineering and Methodology, 14(3):331--380, July 2005. (c) Prof. U. Aßmann

  3. Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie – Prof. Aßmann - Softwaretechnologie II 23.1 Jackson Structured Programming as Data-Oriented Development with Regular Data „Grammarware“ is the technical space of all grammars ● describing data structures.

  4. Data-Oriented Development (for „Grammarware“) S o f t w a r e t e c h n o l o g i e I I D a t a - o r i e n t e d d e v e l o p m e n t f o c u s e s fjrst on the development of a data structure ● T r e e s p e c i fj c a t i o n w i t h s t r i n g g r a m m a r s o r t r e e g r a m m a r s – Attributed tree specifjcation with attributed grammars – Link tree specifjcations (e.g., with XML schema) – Graph specifjcations with graph grammars and graph transformation systems (e.g., reducible – graphs) Path specifjcations with automata – Divide: fjnd subdata structures ● Conquer: compose subdata structures to larger data units ● Second step : Derive a visiting algorithm that works on all elements of the data ● structure in a pre-defjned, specifjed way (similar to design pattern Visitor) Surprising: Grammars cannot only be used to parse strings, but to specify the w a l k o r d e r of a – visiting algorithm! (c) Prof. U. Aßmann Design Question: Design Question: How is the data structured? How is the data structured? so that the algorithms can homomorphically be derived from its so that the algorithms can homomorphically be derived from its structure structure

  5. Example for Data-Oriented Design: Jackson Structured Programming JSP S o f t w a r e t e c h n o l o g i e I I Data-oriented developing with hierarchical tree diagrams, a variant of a ● function/action tree The tree defjnes a w a l k o r d e r over a sequence of data elements or an event stream ● from which code is generated JSP was one of the earliest model-driven development methods (from specifjcations, code is – generated) (c) Prof. U. Aßmann Design Question: Design Question: How is the data structured? How is the data structured? so that the algorithms can homomorphically be derived from its so that the algorithms can homomorphically be derived from its structure structure

  6. Jackson Structured Diagrams (Jackson Process Trees) S o f t w a r e t e c h n o l o g i e I I A J a c k s o n S t r u c t u r e d D i a g r a m ( J S D J a c k s o n P r o c e s s T r e e ) is a function free with ● iteration and alternatives. Its tree constructors stem from regular expressions: S e q u e n c e transforms to sequenced statements – Repetition * : transforms to loops or recursion (Kleene star) – Alternative o : transforms to if- and case-instructions – produce tea Sequence add boiling put tea in pot wait water Repetition pour spoon tea (c) Prof. U. Aßmann into pot * // regular expression in regular language: // regular expression in regular language: produceTea = produceTea = (fetchGreenTea | fetchBlackTea)* AddBoilingWater Wait (fetchGreenTea | fetchBlackTea)* AddBoilingWater Wait Alternative fetch green tea o fetch black tea o

  7. Example for Data-Oriented Design: Jackson Structured Programming JSP S o f t w a r e t e c h n o l o g i e I I Notation: ● Jackson Structured Diagrams JSD (regular actions), equivalent to regular expressions on – actions and fjnite state machines Development Process: ● Elaboration : Draw JST trees for inputs and outputs – Transformation : Merge them – Elaboration: List the operations and allocate to program parts – Elaboration : Convert program to code (generate code) – Elaboration : Add conditions – Heuristics : ● Readahead – Backtracking – Program inversion if structure of input does not match output – Extension points: ● (c) Prof. U. Aßmann Where can sub-data structures be added? –

  8. When Should JSP Be Applied? S o f t w a r e t e c h n o l o g i e I I JSP is good for problems that are “governed” by a data structure that corresponds to a ● regular expression: if data has the structure of a regular expression – and input is homomorphic to output – -> Algorithm becomes homomorphic to data structure – JST can describe the activity in a DFD (instead of minispecs in pseudocode) ● Then, input is read from the input channels until end-of-stream – Output is produced by the JST – Table processing in information systems is a perfect application area for JSP ● DFD form the data fmow; JSP is the specifjcation of the elementary activities – The generated implementation is in COBOL(!) or another imperative language – (c) Prof. U. Aßmann Data-Driven Design is used in the design of Data-Driven Design is used in the design of Information Systems Information Systems

  9. Deriving a Regular Grammar from a JSD Tree S o f t w a r e t e c h n o l o g i e I I The generated grammar can be fed into a p a r s e r g e n e r a t o r to produce a parser recognizing ● the order of events, e.g., www.antlr.org Grammar TeaPot { produce tea Grammar TeaPot { RULES RULES ProduceTea ::= PutTeaInPot ProduceTea ::= PutTeaInPot AddBoilingWater Wait . AddBoilingWater Wait . add boiling put tea in pot wait water PutTeaInPot ::= PutTeaInPot ::= pour spoon tea PourSpoonTeaIntoPot* . PourSpoonTeaIntoPot* . into pot * <<generate>> PourSpoonTeaIntoPot ::= PourSpoonTeaIntoPot ::= fetch green fetch black tea o FetchGreenTea tea o FetchGreenTea | FetchBlackTea | FetchBlackTea (c) Prof. U. Aßmann . . } }

  10. Deriving a System of Procedures from the JSD Tree S o f t w a r e t e c h n o l o g i e I I procedure ProduceTea() { produce tea procedure ProduceTea() { PutTeaInPot(); PutTeaInPot(); AddBoilingWater(); AddBoilingWater(); Wait(); Wait(); add boiling put tea in pot wait } water } procedure PutTeaInPot() { procedure PutTeaInPot() { pour spoon tea while (condition) { while (condition) { into pot * <<generate>> PourSpoonTeaIntoPot(); PourSpoonTeaIntoPot(); } } fetch green fetch black tea o procedure PourSpoonTeaIntoPot() { tea o procedure PourSpoonTeaIntoPot() { if (condition) if (condition) (c) Prof. U. Aßmann FetchGreenTea(); FetchGreenTea(); else else FetchBlackTea(), FetchBlackTea(), } }

  11. Table- and Record-Manipulatjon Programs in Informatjon Systems with JSP S o f t w a r e t e c h n o l o g i e I I M a n y i n f o r m a t i o n s y s t e m s r e l y o n r e l a t i o n a l d a t a p r o c e s s i n g with tables ● containing records (tuples) with information about employees, insured persons, members of networks, unemployed people, customers, etc Algorithms on these tables with recorrds can easily be expressed by JSP ● process trees ( t h r e s h o l d q u e r y ) – w h i c h p e r s o n s e a r n mo r e t h a n 1 5 0 0 € i n o u r c o mp a n y ? „ (max query) – „ w h o e a r n s mo s t o f o u r A u s t r i a n e mp l o y e e s “ (avg operator) – „ c o mp u t e t h e a v e r a g e s a l a r y o f o u r e mp l o y e e s “ (map-reduce operator) – „ h o w mu c h w o u l d a 5 % i n c r e a s e o f s a l a r y c o s t o u r c o mp a n y ? “ #id Name FirstName Street Town Salary 12 John Silver Obergasse 2a Wien 1200€ (c) Prof. U. Aßmann 13 Bobby Brown Traubenweg 12 Bad Tölz 600€ 14 Frank Foster Blumenweg 6 München 2000€ 20 Sue Smith Tulpengasse 3 Füssen 2300€ 25 Mary Miller Heurigenweg 2 Linz 1500€

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend