IMPROVING PROGRAM COMPREHENSION TOOLS FOR DOMAIN-SPECIFIC LANGUAGES Supervisors: Professor Pedro Rangel Henriques Professora Maria João Varanda Pereira.

Slides:



Advertisements
Similar presentations
Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)
Advertisements

Semantics Static semantics Dynamic semantics attribute grammars
8. Introduction to Denotational Semantics. © O. Nierstrasz PS — Denotational Semantics 8.2 Roadmap Overview:  Syntax and Semantics  Semantics of Expressions.
Cognition and Reading Sharon Weiss-Kapp Clinical Assistant Professor MGH-Institute of Health Professions Senior Clinical Associate Children’s Hospital.
Background information Formal verification methods based on theorem proving techniques and model­checking –to prove the absence of errors (in the formal.
Fall Semantics Juan Carlos Guzmán CS 3123 Programming Languages Concepts Southern Polytechnic State University.
1 Semantic Description of Programming languages. 2 Static versus Dynamic Semantics n Static Semantics represents legal forms of programs that cannot be.
CS 355 – Programming Languages
1 Pass Compiler 1. 1.Introduction 1.1 Types of compilers 2.Stages of 1 Pass Compiler 2.1 Lexical analysis 2.2. syntactical analyzer 2.3. Code generation.
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
An Introduction to Software Visualization Dr. Jonathan I. Maletic Software DevelopMent Laboratory Department of Computer Science Kent State University.
Describing Syntax and Semantics
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Program Analysis Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
Strategies to relate the program and problem domains using code instrumentation Mario Marcelo Berón University of Minho Pedro Rangel Henriques University.
Research in Compilers and How it Relates to Software Engineering Part III: Relation to SE Tomofumi Yuki EJCP 2015 June 22, Nancy.
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
CASE Tools And Their Effect On Software Quality Peter Geddis – pxg07u.
Software Development Concepts ITEC Software Development Software Development refers to all that is involved between the conception of the desired.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
Katanosh Morovat.   This concept is a formal approach for identifying the rules that encapsulate the structure, constraint, and control of the operation.
Planning for the Solution
Design Pattern Interpreter By Swathi Polusani. What is an Interpreter? The Interpreter pattern describes how to define a grammar for simple languages,
Domain-Specific Software Development Terminology: Do We All Speak the Same Language? Arturo Sánchez-Ruíz, University of North Florida, USA Motoshi Saeki,
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
Lesson 3 McManus COP  You have to tell them ◦ what to do ◦ what to use ◦ in what order to do itand ◦ what to do if your user does not do what.
Chapter Twenty-ThreeModern Programming Languages1 Formal Semantics.
Pattern-directed inference systems
Lecture 7 Declarative Knowledge English Study Program FKIP – UNSRI July
Formal Semantics Chapter Twenty-ThreeModern Programming Languages, 2nd ed.1.
LOGIC AND ONTOLOGY Both logic and ontology are important areas of philosophy covering large, diverse, and active research projects. These two areas overlap.
Illustrations and Answers for TDT4252 exam, June
Software Engineering Design & UML.
FDT Foil no 1 On Methodology from Domain to System Descriptions by Rolv Bræk NTNU Workshop on Philosophy and Applicablitiy of Formal Languages Geneve 15.
Convergence of Model Checking & Program Analysis Philippe Giabbanelli CMPT 894 – Spring 2008.
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
ISBN Chapter 3 Describing Semantics.
Semantics for DSL Group Members: Ritu Arora, Diyang Chu, Zekai Demirezen, Jeff Gray, Jacob Gulotta, Luis Pedro, Arturo Sanchez, Greg Sullivan,Ximing Yu.
Chapter 3 Part II Describing Syntax and Semantics.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Semantics In Text: Chapter 3.
CS536 Semantic Analysis Introduction with Emphasis on Name Analysis 1.
Weaving a Debugging Aspect into Domain-Specific Language Grammars SAC ’05 PSC Track Santa Fe, New Mexico USA March 17, 2005 Hui Wu, Jeff Gray, Marjan Mernik,
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
Program Comprehension for Domain-Specific Languages Maria João Varanda 1, Marjan Mernik 2, Daniela da Cruz 3, Pedro Henriques 3 1 Polytechnic Institute.
The Interpreter Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
International Conference on Fuzzy Systems and Knowledge Discovery, p.p ,July 2011.
Parastoo Mohagheghi 1 A Multi-dimensional Framework for Characterizing Domain Specific Languages Øystein Haugen Parastoo Mohagheghi SINTEF, UiO 21 October.
CS412/413 Introduction to Compilers Radu Rugina Lecture 13 : Static Semantics 18 Feb 02.
Concepts and Realization of a Diagram Editor Generator Based on Hypergraph Transformation Author: Mark Minas Presenter: Song Gu.
Formal Verification. Background Information Formal verification methods based on theorem proving techniques and model­checking –To prove the absence of.
Artificial Intelligence: Research and Collaborative Possibilities a presentation by: Dr. Ernest L. McDuffie, Assistant Professor Department of Computer.
LDK R Logics for Data and Knowledge Representation Propositional Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,
From Use Cases to Implementation 1. Structural and Behavioral Aspects of Collaborations  Two aspects of Collaborations Structural – specifies the static.
From Use Cases to Implementation 1. Mapping Requirements Directly to Design and Code  For many, if not most, of our requirements it is relatively easy.
MDD-Kurs / MDA Cortex Brainware Consulting & Training GmbH Copyright © 2007 Cortex Brainware GmbH Bild 1Ver.: 1.0 How does intelligent functionality implemented.
Algorithms and Flowcharts
Instructional Strategies
Knowledge Representation Techniques
About the Presentations
Knowledge Representation
Teaching with Instructional Software
Logical architecture refinement
Internet of Things A Process Calculus Approach
Algorithm and Ambiguity
Logics for Data and Knowledge Representation
Applying Use Cases (Chapters 25,26)
Representations & Reasoning Systems (RRS) (2.2)
Presentation transcript:

IMPROVING PROGRAM COMPREHENSION TOOLS FOR DOMAIN-SPECIFIC LANGUAGES Supervisors: Professor Pedro Rangel Henriques Professora Maria João Varanda Pereira University of Minho, Department of Informatics Nuno Oliveira

Imagine the following scenario: 1 You are a software analyst… …who is assigned a task of maintaining a software piece

2 Well… this is just a part of that software… void fn() { struct model *o = (struct model *)malloc(sizeof(struct model)); o->switch = true; while(o->switch){ try_sense(o); if(o->sensor_date != NULL){ o->p ++; o->h = 1; o->b = (struct object*)malloc(sizeof(struct object)); o->b = o->sensor_date; o->sensor_date = NULL; o->b->next = NULL; }

Your first reaction… 3 And this would be the second one… - What does this program do? - What are its effects on the real world concepts? - What is it all about? - I Can’t even figure out the problem domain! So you’d probably give up on maintaining such code.

4 Robots are picking stones, but their arms never go back down, after the first stone! Boss You Ah, Ok! Let me see it again. But… what if, somehow, you have information about the problem domain?

5 In fact, this code can solve a lot of problems, and none in particular void fn() { struct model *o = (struct model *)malloc(sizeof(struct model)); o->switch = true; while(o->switch){ try_sense(o); if(o->sensor_date != NULL){ o->p ++; o->h = 1; o->b = (struct object*)malloc(sizeof(struct object)); o->b = o->sensor_date; o->sensor_date = NULL; o->b->next = NULL; } But if you know that this code corresponds to a robot task…

6 Then… Program Comprehension (PC) tools (PCTools) will fasten the way you work… JIRiSS Imagix4D DA4Java CodeCrawler Cerberus Bauhaus Alma Alborz SeeSoft Rigi Reflexion Model PICS SHriMP

7 You will not be able to easily know what statement do what in the real world objects… And… Do not take advantage of Problem Domain Do not connect Problem and Program Domains automatically So… Maintenance main tasks are still hand-made, increasing time and expenditures! That is the HARDEST part!!

8 Brooks theorizes that: A program is better understood if the person who is through the process of comprehension knows the program and problem domains, and is capable of establishing bridges between them. To formalize such theory in a tool for General Purpose Languages (GPL) is impossible or, at least, is neither easy nor direct! Would it be the same with Domain-Specific Languages? Why?

Well, imagine again the same scenario: 9 You are a software analyst… …who is assigned a task of maintaining a software piece

10 … and that software was developed with a DSL: PROGRAM { TURN_ON WHILE (TURNED_ON){ IF(HAS_STONE_IN_FRONT){ ROBOT_ARM_ON; PICK_STONE; DROP_STONE_IN_BAG; }

Your first reaction… 11 - What does this program do? - What are its effects on the real world concepts? - Is that all? - We’re talking about a robot task… - First, the robot is started, then, in a loop, it picks stones into a bag, whenever it senses one… And this would be the second reaction…

12 Do I need to tell you where the error is? Boss You No, boss! Already found it! Yes, that was easy, but… what if the DSL is more complex? A PCTool improved to cope with DSL advantages would help us! Is it possible?

13 If we prove the following three things:

14 Can the PC techniques, tailored for GPLs, be applied on DSLs?

15 ALMA - A system to assist program comprehension tasks for ANY GPL DAST – Decorated Abstract Syntax Tree ( ALMA internal representation (IR) ) The DAST stores the meaning of the program by using semantic patterns as nodes of a tree! The Meaning? TECHNIQUES

16 So, to cope with Problem Domain… ALMA IR needs to be improved… … adding on, to the semantic patterns: represent the Problem Domain Concepts Actors describe the behavior of the concepts according to the operational semantic of the program. Animation Functions Resulting in…

17 represent the animation, at problem domain level, according to the operational semantic of the program Animation Patterns Are injected in the DAST, creating a D AP AST (Decorated with Animation Patterns Abstract Syntax Tree)

18 The DAST technique was used in a PCTool for GPLs… Boss You … and can be added of Animation Patterns to cope with Problem Domain Concepts! Which are static for every statement in a DSL, regardless of the program… So, this answers question 1!

19

20 Evolution: ALMA

21 Evolution: ALMA >> ALMA 2

22 Beautiful… but how we specify a front-end for ALMA2 ? Boss

23 1. Analyse DSL formal definition and its specific domain DSL Formal Definition DSL Problem Domain Program Domain Concepts Problem Domain Concepts Possible Internal State Designing the Problem Visualization by Domains Analysis

24 2. Define mappings between the problem concepts and syntactic or semantic parts of the DSL; Program Domain Concepts Problem Domain Concepts Conceptual Mappings Table Designing the Problem Visualization by Concepts Mappings Definition

25 3. Associate images or image sequences with concepts at problem domain; Problem Domain Concepts Images Behavioural Visualization Table Designing the Problem Visualization by Images and Concepts Association

26 4. Use Alma 2 to build the mappings between problem and program domains and the imagery. Conceptual Mappings Table Behavioural Visualization Table Alma 2 Front-End for DSPs Designing the Problem Visualization by Definition of ALMA2 Specification Theory is good, what about practice?

27 rule Instruction_TurnLeft { INSTRUCTION ::= #Turnleft compute { INSTRUCTION.tree = new Alma.CStmtsNode( new AnimAssignNode( tA, new Alma.COperNode( new Alma.CVarNode(tA), new Alma.CConstNode(90), "+” ), new Alma.CConstNode(360), "%"), new AnimationPattern[] { new APRotate(robot, new int[] {1}, "angle"), new APLabel(robot, new int[] {1}, "beepers: ", "beepers") } ) ); }; } = a % a 90 Rotate Label For each grammar rule we define 1. The Operational Semantics using ALMA2 basic API and 2. The Operational Behaviour using ALMA2 extended API

28 ALMA 2 tested with Imperative DSL

29 ALMA 2 tested with Declarative DSL

30 The improvement of ALMA to ALMA2 is possible… Boss You … and the animation of the Problem Domain concepts together with the visualization of program domain, is a better perspective for the users! We can only be sure of its usefulness if we prove it… Let’s prove it then!

31 Extended Brooks Theory A program comprehension tool, will ease the task of comprehending a program when synchronized visualizations of its program and problem domains are provided, since from these visualizations, the user is able to build a conceptual knowledge base that easily bridges both program and problem domains. Extended Brooks Theory A program comprehension tool, will ease the task of comprehending a program when synchronized visualizations of its program and problem domains are provided, since from these visualizations, the user is able to build a conceptual knowledge base that easily bridges both program and problem domains.

32 The Proof Ingredients: 20 Participants 1 Questionnaire (8 Questions) The Proof Objectives: Compare variables measured both in Alma and Alma 2 Solve PC tasks using Alma and Alma 2 Measure variables with the questions: Time (spent in the questions) Correctness (in the answers) Relevance assigned to the approach (of the synchronized visualizations)

33 Time Correctness Relevance The Proof Results:

34 Despite of spending more time to create a mental model of the program… Boss You So, maintenance time and expenditures are reduced! …With this approach, the effectiveness of the comprehension is achieved… Meaning that synchronized Visualizations of Prog. And Prob. Domains are important to achieve the comprehension of the program Conclusion

35 Because the connection of both domains allows us to: Boss You -Perceive how the program does; - Perceive what are the effects of the program in the problem domain… Conclusion And of course, to achieve knowledge through an Action-Effect paradigm.

IMPROVING PROGRAM COMPREHENSION TOOLS FOR DOMAIN-SPECIFIC LANGUAGES Thank you!! University of Minho, Department of Informatics Nuno Oliveira