08/05/2015Dr Andy Brooks1 MSc Software Maintenance MS Viðhald hugbúnaðar Fyrirlestrar 15 & 16 Programmers Use Slices When Debugging.

Slides:



Advertisements
Similar presentations
11-1 Empirical Models Many problems in engineering and science involve exploring the relationships between two or more variables. Regression analysis.
Advertisements

CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
IGCSE Coursework August 2011 The write up for this experiment should be word processed if possible A hard copy should be submitted by next Monday No excuses.
Damian Gordon.  Static Testing is the testing of a component or system at a specification or implementation level without execution of the software.
The Assembly Language Level
Using Dataflow Diagrams
Programming Types of Testing.
Program Slicing Mark Weiser and Precise Dynamic Slicing Algorithms Xiangyu Zhang, Rajiv Gupta & Youtao Zhang Presented by Harini Ramaprasad.
1 Program Slicing Purvi Patel. 2 Contents Introduction What is program slicing? Principle of dependences Variants of program slicing Slicing classifications.
Statistical Issues in Research Planning and Evaluation
Programming Logic and Design, Third Edition Comprehensive
Programming Creating programs that run on your PC
10/06/2015Dr Andy Brooks1 MSc Software Maintenance MS Viðhald Hugbúnaðar Fyrirlestrar 27 & 28 Debugging with the Whyline tool
6.1 Copyright © 2014 Pearson Education, Inc. publishing as Prentice Hall Building Information Systems Chapter 13 VIDEO CASES Video Case 1: IBM: Business.
Using Dataflow Diagrams
Software Quality Control Methods. Introduction Quality control methods have received a world wide surge of interest within the past couple of decades.
28/06/2015Dr Andy Brooks1 MSc Software Maintenance MS Viðhald hugbúnaðar Fyrirlestrar 13 & 14 Do Visualizations Improve Program Comprehensibility?
28/06/2015Dr Andy Brooks1 MSc Software Maintenance MS Viðhald hugbúnaðar Fyrirlestrar 25 & 26 The Importance of Typographic Style “Hence, the book format.
Modules, Hierarchy Charts, and Documentation
1 1 Slide © 2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole.
1 1 Slide © 2003 South-Western/Thomson Learning™ Slides Prepared by JOHN S. LOUCKS St. Edward’s University.
1 1 Slide © 2008 Thomson South-Western. All Rights Reserved Slides by JOHN LOUCKS & Updated by SPIROS VELIANITIS.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Answering questions about life with statistics ! The results of many investigations in biology are collected as numbers known as _____________________.
Dr Andy Brooks1 FOR0383 Software Quality Assurance Lecture 1 Introduction Forkröfur/prerequisite: FOR0283 Programming II Website:
Simple Program Design Third Edition A Step-by-Step Approach
Programming Translators.
Science Fair Project: Basic Outline
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
CategoryAdvancedProficientDevelopingNeeds Improvement 5.6D Design an experiment that tests the effect of force on an object. In addition to the proficient.
Chapter 8 Introduction to Hypothesis Testing
Chapter 10: Compilers and Language Translation Invitation to Computer Science, Java Version, Third Edition.
1 1 Slide © 2005 Thomson/South-Western Slides Prepared by JOHN S. LOUCKS St. Edward’s University Slides Prepared by JOHN S. LOUCKS St. Edward’s University.
1 1 Slide © 2003 Thomson/South-Western Chapter 13 Multiple Regression n Multiple Regression Model n Least Squares Method n Multiple Coefficient of Determination.
1 1 Slide © 2007 Thomson South-Western. All Rights Reserved OPIM 303-Lecture #9 Jose M. Cruz Assistant Professor.
1 1 Slide © 2007 Thomson South-Western. All Rights Reserved Chapter 13 Multiple Regression n Multiple Regression Model n Least Squares Method n Multiple.
1 1 Slide © 2012 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole.
By: TARUN MEHROTRA 12MCMB11.  More time is spent maintaining existing software than in developing new code.  Resources in M=3*(Resources in D)  Metrics.
Chapter 3 Developing an algorithm. Objectives To introduce methods of analysing a problem and developing a solution To develop simple algorithms using.
Generic Approaches to Model Validation Presented at Growth Model User’s Group August 10, 2005 David K. Walters.
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
Chapter 1 Introduction to Statistics. Statistical Methods Were developed to serve a purpose Were developed to serve a purpose The purpose for each statistical.
Educational Research: Competencies for Analysis and Application, 9 th edition. Gay, Mills, & Airasian © 2009 Pearson Education, Inc. All rights reserved.
Developing an Algorithm
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
Introduction To PROLOG World view of imperative languages. World view of relational languages. A PROLOG program. Running a PROLOG program. A PROLOG.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
The Software Development Process
1 Program Planning and Design Important stages before actual program is written.
Chapter One An Introduction to Programming and Visual Basic.
FOUNDATION IN INFORMATION TECHNOLOGY (CS-T-101) TOPIC : INFORMATION SYSTEM – SOFTWARE.
12.3 Efficient Diversification with Many Assets We have considered –Investments with a single risky, and a single riskless, security –Investments where.
1.  Introduction  The Benefits of the Report Writer Module ◦ For Detail and Summary Printing ◦ For Control Break Processing ◦ For Printing Headings.
Program Slicing Techniques CSE 6329 Spring 2013 Parikksit Bhisay
An Eyetracking Analysis of the Effect of Prior Comparison on Analogical Mapping Catherine A. Clement, Eastern Kentucky University Carrie Harris, Tara Weatherholt,
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Programming Logic and Design Fifth Edition, Comprehensive Chapter 6 Arrays.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Irwin/McGraw-Hill © Andrew F. Siegel, 1997 and l Chapter 7 l Hypothesis Tests 7.1 Developing Null and Alternative Hypotheses 7.2 Type I & Type.
Hypothesis Tests l Chapter 7 l 7.1 Developing Null and Alternative
ICS 3UI - Introduction to Computer Science
Testing and Debugging PPT By :Dr. R. Mall.
Week 12 Option 3: Database Design
Science Fair Project: Basic Outline
SwE 455 Program Slicing.
Chapter 1 Introduction(1.1)
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Programming Logic and Design Fifth Edition, Comprehensive
Basic Concepts of Algorithm
Chapter 10: Compilers and Language Translation
Presentation transcript:

08/05/2015Dr Andy Brooks1 MSc Software Maintenance MS Viðhald hugbúnaðar Fyrirlestrar 15 & 16 Programmers Use Slices When Debugging

08/05/2015Dr Andy Brooks2 Case Study Dæmisaga Reference Programmers Use Slices When Debugging, Mark Weiser, Communications of the ACM, Volume 25, Number 7, pp , 1982.

08/05/2015Dr Andy Brooks3 The basic debugging method Reading 1 million lines of code, from beginning to end, to locate and remove a bug is not efficient. –100 LOC/day equates to days... –1000 LOC/day equates to 1000 days... The basic debugging method is to begin at the statement where the error appears and then reason backwards about the previous sequence of statements.

08/05/2015Dr Andy Brooks4 Reasoning backwards Reasoning backwards to determine all the influences on a variable usually reveals that many statements in the program have no influence. Sometimes you reason backward to the hardware or translation software...

08/05/2015Dr Andy Brooks5 Program Slicing “The process of stripping a program of statements without influence on a given variable at a given statement is called program slicing.” “An elementary slicing criterion of a program P is a tuple where i denotes a specific statement in P and V is a subset of variables in P.” Að sneiða

08/05/2015Dr Andy Brooks6 A program and a program slice 1BEGIN 2READ(X,Y) 3TOTAL:=0.0 4SUM:=0.0 5IF X<=1 6 THEN SUM:=Y 7 ESLE BEGIN 8 READ(Z) 9 TOTAL:=X*Y 10 END 11 WRITE(TOTAL,SUM) 12 END. Slice on Z at statement 12 BEGIN READ(X,Y) IF X<=1 THEN ELSE READ(Z) END. TOTAL, SUM and Y have no influence on Z.

08/05/2015Dr Andy Brooks7 A program and a program slice 1BEGIN 2READ(X,Y) 3TOTAL:=0.0 4SUM:=0.0 5IF X<=1 6 THEN SUM:=Y 7 ESLE BEGIN 8 READ(Z) 9 TOTAL:=X*Y 10 END 11 WRITE(TOTAL,SUM) 12 END. Slice on X at statement 9 BEGIN READ(X,Y) END.

08/05/2015Dr Andy Brooks8 A program and a program slice 1BEGIN 2READ(X,Y) 3TOTAL:=0.0 4SUM:=0.0 5IF X<=1 6 THEN SUM:=Y 7 ESLE BEGIN 8 READ(Z) 9 TOTAL:=X*Y 10 END 11 WRITE(TOTAL,SUM) 12 END. Slice on TOTAL at statement 12 BEGIN READ(X,Y) TOTAL:=0.0 IF X<=1 THEN ELSE TOTAL:=X*Y END.

08/05/2015Dr Andy Brooks9 Experimental Hypothesis H1 “... debugging programmers, working backwards from the variable and statement of a bug´s appearance, use that variable and statement as a slicing criterion to construct mentally the corresponding program slice.” Experimental Hypothesis H2 “... programmers look at code only in contiguous pieces.” tilgáta

08/05/2015Dr Andy Brooks10 “Slices are generally not contiguous pieces, but contain statements scattered throughout the code.” contiguous aðlægur xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx slice

08/05/2015Dr Andy Brooks11 Method 1.Programmers debug three programs. 2.Test programmers´ memory of various code fragments particularly the program slice relevant to the bug. “If the programmers did slice, then their memories for the relevant slices should be at least as good as their memories of contiguous code, and somewhat better than their memories of other non-contiguous code.”

08/05/2015Dr Andy Brooks12 It is important to recognise that programmers were not observed working with the programs. Their actions and the program statements they considered were not recorded. Testing programmers´ memory is an indirect measurement. –And you may not be measuring what you think you are measuring...

08/05/2015Dr Andy Brooks13 Materials Three programs written in Algol-W Program sizes from 75 to 150 lines of code Program TALLY –An IBM scientific subroutine –poorly structured and non-mnemonic variable names Program PAYROLL –written for the experiment –computes salaries and deductions –well structured and mnemonic variable names Program EVADE –written for the experiment –simulation of random aircaft turns –well structured and mnemonic variable names

08/05/2015Dr Andy Brooks14 Program bugs ProgramOriginal codeBug EVADELEFTOT:=LEFTOT-HORT*THRUSTLEFTOT:=HORT*THRUST TALLYSCNT:=SCNT+1.0SCNT:=SCNT-1.0 PAYROLLEXEMPTHOURS:=OVERTIMEPAY:=0OVERTIMEPAY:=0.0 The bugs were chosen so that the entire experiment could be completed in less than an hour.

08/05/2015Dr Andy Brooks15 5 types of program fragments shown to programmers: 1.Relevant slice 2.Relevant contiguous overlapped the relevant slice 3.Irrelevant contiguous did not overlap relevant contiguous did not overlap relevant slice program TALLY had no irrelevant contiguous 4.Irrelevant slice 5.Jumble every 3rd or 4th statement

08/05/2015Dr Andy Brooks16 Fragment overlap relevant slice & relevant contiguous EVADETALLYPAYROLL Overlap is the fraction of statements shared by two fragments.

08/05/2015Dr Andy Brooks17 Syntactic changes Syntactic changes were made to the code fragments to prevent recognition by a particular detail: –Variables and constants in the fragments were renamed as single letters followed by a unique number. –Indenting was adjusted from the original program to a form internally consistent with each fragment.

08/05/2015Dr Andy Brooks18 Participants Experienced Algol-W programmers Graduate student teaching assistants –all from the University of Michigan in Ann Arbor 26 volunteers –4 participated in pilot studies –1 did not follow instructions in the experiment –21 final participants þátttakendur

08/05/2015Dr Andy Brooks19 Pilot studies are conducted to: –To check experimental materials are in order. Instructions are clear. –To check experimental processes are sound. There is sufficient time to complete tasks. Participants behave in the way expected. Weiser reports that pilot studies were conducted but fails to report on actions taken as a result of the pilot studies. Any actions taken should be briefly reported.

08/05/2015Dr Andy Brooks20 Procedure Participants were given all three programs to debug in random order. Participants were then asked to rate 14 program fragments for how sure they were the fragment had been used in one of the three programs. –remember, program TALLY had no irrelevant contiguous fragment (3*5-1 = 14) Code fragments were given in random order each on a separate page with its rating scale. Participants were told not to look back either at the programs or at previously rated code fragments.

08/05/2015Dr Andy Brooks21 Part of the relevant slice for PAYROLL

08/05/2015Dr Andy Brooks22 Fragment shown to participants Rating scale recognition

08/05/2015Dr Andy Brooks23 Results All 21 participants found the bugs in TALLY and EVADE but only 17 found the bug in PAYROLL. ProgramMeanStandard Deviation TALLY EVADE PAYROLL Table IV Debugging times (minutes)

08/05/2015Dr Andy Brooks24 Results A two-way analysis of variance using Friedman´s test indicated an overall difference in the ratings of the different fragments. –fragment type, program type

08/05/2015Dr Andy Brooks25 Results Figure 3 by fragment type 28% 24% 54% Why is recognition so high?

08/05/2015Dr Andy Brooks26 Significant differences Wilcoxon matched-pairs signed-ranks test The difference between relevant slices and irrelevant slices is significant at the 0.03 level. The difference between relevant slices and jumbles is very significant at the level.

08/05/2015Dr Andy Brooks27 Results Irrelevant contiguous was recognised because the programs were small and the irrelevant contiguous fragments were close to the output statements which wrote the incorrect variable values. –Participants would likely have examined code around these output statements.

08/05/2015Dr Andy Brooks28 Results Figure 4 by fragment type and program type

08/05/2015Dr Andy Brooks29 Results Figure 4 TALLY shows the greatest recognition of the relevant slice fragment. Because TALLY was poorly structured (many GOTOS), perhaps more programmers adopted a slicing strategy to debug it.

08/05/2015Dr Andy Brooks30 Results Table V To conclude the experiment, participants were asked about the typicalness of the programs and the bugs. Table V shows that the mean ratings were at least 2.4 on a 1 to 4 scale. –4 meant “very typical” –1 meant “not at all typical”. Weiser reasonably concluded that no program was especially atypical.

08/05/2015Dr Andy Brooks31 Examples of slices Figure 6 Slices that are large in relation to the program (e.g. 563/662 statements) are less useful to the program maintainer.

08/05/2015Dr Andy Brooks32 Implications Tools that automatically generate program slices can help maintainers debug faulty code. Novice programmers should be taught the concept of slicing. Today, researchers study many different kinds of slicing techniques. Dynamic slicing makes use of knowledge about the input, and this can greatly reduce the size of slices.

08/05/2015Dr Andy Brooks33 Slicing or not ? “Because the relevant slice fragment overlapped the relevant sequential fragment in each program, this experiment gives no absolute assurance that relevant slices were not recognised only because of that overlap.” Table II indicates that recognition ratings between relevant slice fragments and relevant sequential fragments are poorly correlated. This suggests that participants could have been recognising relevant slice fragments because they had indeed been slicing, but...

08/05/2015Dr Andy Brooks34 In experimental work it is better to directly measure than indirectly measure. Nowadays, it is possible to build and use tools to record all user actions and so help establish if program slicing occurred or not. Even in Weiser´s day, he could have recorded participants speaking their thoughts and actions aloud and then analysed the recordings to help establish if program slicing had occurred or not.

08/05/2015Dr Andy Brooks35 At the very least, Weiser should have asked his participants at the end of the experiment what actions they performed to debug the programs. Because the programs were so small, it is quite possible that relevant slice recognition occurred because (some or all) participants had simply read all the code involved. It would be interesting to know what the recognition rates would have been if fragments shown to participants had not been syntactically altered.

08/05/2015Dr Andy Brooks36 You never really know what is going on inside someone´s head.