Translating Code Comments to Procedure Specifications
|
|
- Cori Benson
- 5 years ago
- Views:
Transcription
1 Translating Code Comments to Procedure Specifications Arianna Blasi Alberto Goffi Konstantin Kuznetsov Alessandra Gorla Michael D. Ernst Mauro Pezzè Sergio Delgado USI Università della Svizzera italiana, Switzerland IMDEA Software Institute, Spain Saarland University/CISPA, Germany University of Washington Seattle, WA, USA
2 public static boolean removeall(list mylist){ }
3 public static boolean removeall(list mylist){ }
4 public static boolean removeall(list mylist){ public void testremoveall(){ }
5 public static boolean removeall(list mylist){ public void testremoveall(){ List<Integer> list = Arrays.asList(1, 2, 3); }
6 public static boolean removeall(list mylist){ public void testremoveall(){ List<Integer> list = Arrays.asList(1, 2, 3); boolean result = removeall(list); }
7 public static boolean removeall(list mylist){ public void testremoveall(){ List<Integer> list = Arrays.asList(1, 2, 3); boolean result = removeall(list); assert? }
8 public static boolean removeall(list mylist){ public void testremoveall(){ List<Integer> list = Arrays.asList(1, 2, 3); boolean result = removeall(list); assert? } We have no idea
9
10
11 Where is the oracle?
12 Where is the oracle? Where is the specification?
13
14 Why not generating executable specifications automatically?
15 Why not generating executable specifications automatically? Let s rely on Javadoc comments!
16 Our solution /** true if the list is empty */ public static boolean removeall(list mylist) { }
17 Our solution /** true if the list is empty */ public static boolean removeall(list mylist) { } mylist.isempty()? result==true
18 Our solution /** true if the list is empty */ public static boolean removeall(list mylist) { } mylist.isempty()? result==true
19 Our solution /** true if the list is empty */ public static boolean removeall(list mylist) { } mylist.isempty()? public void testremoveall(){ List<Integer> list = Arrays.asList(1, 2, 3); boolean result = removeall(list); }
20 Our solution /** true if the list is empty */ public static boolean removeall(list mylist) { } mylist.isempty()? public void testremoveall(){ List<Integer> list = Arrays.asList(1, 2, 3); boolean result = removeall(list); if(list.isempty()) assert result==true; }
21 Our solution /** true if the list is empty */ public static boolean removeall(list mylist) { } mylist.isempty()? public void testremoveall(){ List<Integer> list = Arrays.asList(1, 2, 3); boolean result = removeall(list); if(list.isempty()) assert result==true; }
22 The idea is not new...
23 The idea is not Tan et al. ICST 2012
24 The idea is not Tan et al. ICST 2012 Toradocu Goffi et al. ISSTA 2016
25 The idea is not Tan et al. ICST 2012 Toradocu Goffi et al. ISSTA 2016 ALICS Pandita et al. ICSE 2012
26 The idea is not Tan et al. ICST 2012 Preconditions Normal Postconditions Exceptional Postconditions Toradocu Goffi et al. ISSTA 2016 ALICS Pandita et al. ICSE 2012
27 The idea is not Tan et al. ICST 2012 Preconditions Normal Postconditions Exceptional Postconditions Toradocu Goffi et al. ISSTA 2016 ALICS Pandita et al. ICSE 2012
28 The idea is not Tan et al. ICST 2012 Preconditions Normal Postconditions Exceptional Postconditions Toradocu Goffi et al. ISSTA 2016 ALICS Pandita et al. ICSE 2012 Jdoctor
29 Jdoctor Source Javadoc Extractor Comment Translator Specs
30 Source Javadoc Extractor Comment Translator Specs
31 Source Javadoc Extractor Comment Translator Specs Source 1. Expected result 2. Condition (Text)
32 Source Javadoc Extractor Comment Translator Specs Source 1. Expected result 2. Condition (Text) /** true * if the list is empty */ public boolean removeall(list list){ } 1. true 2. if the list is empty
33 Source Javadoc Extractor Comment Translator Specs 1. Expected result 2. Condition (Text) /** true * if the list is empty */ public boolean removeall(list list){ } 1. true 2. if the list is empty
34 Source Javadoc Extractor Comment Translator Specs 1. Expected result 2. Condition (Text)
35 Source Javadoc Extractor Comment Translator Specs 1. Expected result 2. Condition (Text) 1. Expected result 2. Condition (Code)
36 Source Javadoc Extractor Comment Translator Specs 1. Expected result 2. Condition (Text) 1. Expected result 2. Condition (Code) 1. true 2. if the list is empty 1. true 2. mylist.isempty()
37 Source Javadoc Extractor Comment Translator Specs 1. Expected result 2. Condition (Text) 1. Expected result 2. Condition (Code) 1. true 2. if the list is empty 1. true 2. mylist.isempty() mylist.isempty()? result==true
38 Natural Language Specification Comment Translator Java Specification
39 Natural Language Specification Comment Translator NL Parser Subject Matcher Predicate Matcher Java Specification
40 NL Parser Subject Matcher Predicate Matcher if the list is empty
41 NL Parser Subject Matcher Predicate Matcher if the list is empty Subject list Predicate is empty
42 NL Parser Subject Matcher Subject: list Predicate Matcher
43 NL Parser Subject Matcher Subject: list Predicate Matcher Candidates Formal Parameters Class Name Methods Fields
44 NL Parser Subject Matcher Predicate Matcher Subject: list Candidates Formal Parameters Class Name Methods Fields Candidate Distance mylist 2 isempty 7 iterator 8 size 4
45 NL Parser Subject Matcher Predicate Matcher Subject: list Candidates Formal Parameters Class Name Methods Fields Candidate Distance mylist 2 isempty 7 iterator 8 size 4
46 NL Parser Subject Matcher Predicate Matcher Subject: list => mylist Candidates Formal Parameters Class Name Methods Fields Candidate Distance mylist 2 isempty 7 iterator 8 size 4
47 NL Parser Subject Matcher Predicate Matcher Subject Predicate list is empty
48 NL Parser Subject Matcher Predicate Matcher Subject Predicate list is empty
49 NL Parser Subject Matcher Predicate Matcher Subject Predicate list is empty 1: Exact pattern match?
50 NL Parser Subject Matcher Predicate Matcher Subject Predicate list is empty is null == null 1: Exact pattern match?
51 NL Parser Subject Matcher Predicate Matcher Subject Predicate list is empty 1: Exact pattern match? is null == null is negative < 0
52 NL Parser Subject Matcher Predicate Matcher Subject Predicate list is empty 1: Exact pattern match? is null == null is negative < 0 is positive > 0
53 NL Parser Subject Matcher Predicate Matcher Subject Predicate list is empty 1: Exact pattern match? is null == null is negative < 0 is positive > 0...
54 NL Parser Subject Matcher Predicate Matcher Subject Predicate list is empty 1: Exact pattern Toradocu ALICS is null == null is negative < 0 is positive > 0...
55 NL Parser Subject Matcher Predicate Matcher Subject Predicate list is empty "is empty" not Toradocu ALICS is null == null is negative < 0 is positive > 0...
56 NL Parser Subject Matcher Predicate Matcher Subject Predicate list is empty
57 NL Parser Subject Matcher Predicate Matcher Subject Predicate list is empty 2: Syntax match? Toradocu
58 NL Parser Subject Matcher Predicate Matcher Subject Predicate list is empty Candidate Distance mylist 9 2: Syntax match? isempty 1 iterator 6 Toradocu size 7
59 NL Parser Subject Matcher Predicate Matcher Subject Predicate list is empty Candidate Distance 2: Syntax match? mylist 9 isempty 1 iterator 6 Toradocu size 7
60 Pattern and syntax match are not enough
61 Pattern and syntax match are not enough Return true if the list is empty
62 Pattern and syntax match are not enough Return true if the list is empty Candidate Distance clear 7 isempty 1 iterator 6 size 7
63 Pattern and syntax match are not enough Return true if the list is empty contains no element
64 Pattern and syntax match are not enough Return true if the list is empty contains no element has no content
65 Pattern and syntax match are not enough Return true if the list is empty contains no element has no content Candidate mylist isempty iterator size Distance
66 Pattern and syntax match are not enough Return true if the list is empty contains no element has no content Candidate mylist isempty iterator size Distance
67 Pattern and syntax match are not enough Return true if the list is empty contains no element has no content Candidate mylist isempty iterator size Toradocu ALICS
68 Analyzing complex comments /** * Checks if there is a credible threatening unit to * this unit within a range of moves. * moves list of moves True if a threat was found. */ public boolean isindanger(list<object> moves)
69 Analyzing complex comments /** * Checks if there is a credible threatening unit to * this unit within a range of moves. * moves list of moves True if a threat was found. */ public boolean isindanger(list<object> moves)
70 Analyzing complex comments /** * Checks if there is a credible threatening unit to * this unit within a range of moves. * moves list of moves True if a threat was found. */ public boolean isindanger(list<object> moves) searchfordanger(list<object>)
71 threat was found search for danger
72 threat was found search for danger
73
74 search is not displayed as a result
75 We search need more is not than displayed semantic as equivalence a result
76 Word embedding Word embedded in vector space: GloVe, Word2Vec man king woman queen
77 Word embedding Word embedded in vector space: GloVe, Word2Vec danger threat found search
78 Word embedding Word mover's distance (Matt J. Kusner et al., 2015) danger threat found search
79 Word embedding Word mover's distance (Matt J. Kusner et al., 2015) danger threat found search
80 Word Mover's distance Obama speaks in Illinois. In Chicago the president greets the press
81 Word Mover's distance Obama speaks in Illinois. In Chicago the president greets the press
82 Word Mover's distance Obama speaks in Illinois. In Chicago the president greets the press
83 Word Mover's distance Obama speaks in Illinois. In Chicago the president greets the press
84 Word Mover's distance Threat was found Search For Danger
85 Word Mover's distance Threat was found Search For Danger
86 Word Mover's distance Threat was found Search For Danger
87
88 How accurate is Jdoctor?
89 Experimental setup 6 Popular open-source Java systems
90 Experimental setup 563 Analyzed Java methods
91 Experimental setup 829 Manually-written Java conditions
92
93 92 % Precision
94 92 % 83 % Precision Recall
95 Exceptional Postconditions 100% Precision Recall 90% 80% 70% 60% 50% 40% 30% 20% 10% Toradocu Jdoctor
96 Preconditions 100% Precision Recall 90% 80% 70% 60% 50% 40% 30% 20% 10% Toradocu Jdoctor
97 Normal Postconditions 100% Precision Recall 90% 80% 70% 60% 50% 40% 30% 20% 10% Toradocu Jdoctor
98 Overall accuracy 100% Precision Recall 80% 60% 40% 20% Toradocu Jdoctor
99
100 How can you use Jdoctor?
101 Automatic Test Case Generator + Jdoctor
102 + Jdoctor
103 Randoop+Jdoctor reclassification passing passing failing invalid
104 Randoop+Jdoctor reclassification passing passing failing invalid
105 Randoop+Jdoctor reclassification +Jdoctor passing passing failing invalid
106 Randoop+Jdoctor reclassification +Jdoctor passing invalid passing failing invalid
107 Randoop+Jdoctor reclassification +Jdoctor passing invalid = invalid passing failing invalid
108 Randoop+Jdoctor reclassification +Jdoctor passing invalid = invalid passing failing failing invalid
109 Randoop+Jdoctor reclassification +Jdoctor passing invalid = invalid passing failing = missed alarm failing invalid
110 Randoop+Jdoctor reclassification +Jdoctor passing invalid = invalid passing failing = missed alarm failing passing invalid
111 Randoop+Jdoctor reclassification +Jdoctor passing invalid = invalid passing failing = missed alarm failing passing = false alarm invalid
112 Randoop+Jdoctor reclassification +Jdoctor passing invalid = invalid passing failing = missed alarm failing passing = false alarm invalid passing
113 Randoop+Jdoctor reclassification +Jdoctor passing invalid = invalid passing failing = missed alarm failing passing = false alarm invalid passing = new test
114 Missed alarm public static boolean removeall(list mylist){ }
115 Missed alarm public static boolean removeall(list mylist){ public void testremoveall(){ List<Integer> list = Arrays.asList(1, 2, 3); boolean result = removeall(list); }
116 Missed alarm /** true if the list is empty public */ static boolean removeall(list mylist){ } public static boolean removeall(list mylist){ } + public void testremoveall(){ List<Integer> list = Arrays.asList(1, 2, 3); boolean result = removeall(list); }
117 Missed alarm /** true if the list is empty public */ static boolean removeall(list mylist){ } public static boolean removeall(list mylist){ } + public void testremoveall(){ List<Integer> list = Arrays.asList(1, 2, 3); boolean result = removeall(list); if(list.isempty()) assert result==true; }
118 Missed alarm /** true if the list is empty public */ static boolean removeall(list mylist){ } public static boolean removeall(list mylist){ } + public void testremoveall(){ List<Integer> list = Arrays.asList(1, 2, 3); boolean result = removeall(list); if(list.isempty()) assert result==true; }
119 Invalid test public static float max(float[] floatarray){ }
120 Invalid test public static float max(float[] floatarray){ public void testremoveall(){ float[] floatarray0 = null; float float1 = max(floatarray0); }
121 Invalid test /** floatarray array of floats, not null */ public static float max(float[] floatarray){ } + public void testremoveall(){ float[] floatarray0 = null; float float1 = max(floatarray0); }
122 Invalid test /** floatarray array of floats, not null */ public static float max(float[] floatarray){ } + public void testremoveall(){ float[] floatarray0 = null; float float1 = max(floatarray0); } INVALID
123 Reclassification False alarm Missed alarm New test Invalid test
124 Jdoctor Source Javadoc Extractor Comment Translator Specs
125 Jdoctor Source Javadoc Extractor Comment Translator Specs Preconditions
126 Jdoctor Source Javadoc Extractor Comment Translator Specs Preconditions Normal Postconditions
127 Jdoctor Source Javadoc Extractor Comment Translator Specs Preconditions Normal Postconditions Exceptional Postconditions
128 Jdoctor Source Javadoc Extractor Comment Translator Specs Preconditions Pattern Match Normal Postconditions Exceptional Postconditions
129 Jdoctor Source Javadoc Extractor Comment Translator Specs Preconditions Pattern Match Normal Postconditions Syntax Match Exceptional Postconditions
130 Jdoctor Source Javadoc Extractor Comment Translator Specs Preconditions Pattern Match Normal Postconditions Exceptional Postconditions Syntax Match Semantic Match
131 Jdoctor Source Javadoc Extractor Comment Translator Specs Preconditions Pattern Match Normal Postconditions Exceptional Postconditions Syntax Match Semantic Match
Automatic Generation of Oracles for Exceptional Behaviors
Automatic Generation of Oracles for Exceptional Behaviors ISSTA * * Artifact Consistent * Complete * Well Documented * Easy to Reuse * Evaluated * AEC * Alberto Goffi alberto.goffi@usi.ch USI Università
More informationSynthesis of Equivalent Method Calls in Guava
Synthesis of Equivalent Method Calls in Guava Andrea Mattavelli 1, Alberto Goffi 1 and Alessandra Gorla 2 1 Università della Svizzera italiana (USI), Lugano, Switzerland {andrea.mattavelli,alberto.goffi}@usi.ch
More informationNatural language is a programming language
Natural language is a programming language Michael D. Ernst UW CSE Joint work with Arianna Blasi, Juan Caballero, Sergio Delgado Castellanos, Alberto Goffi, Alessandra Gorla, Victoria Lin, Deric Pang,
More informationShin Hwei Tan Darko Marinov Lin Tan Gary T. Leavens University of Illinois. University of Illinois
Shin Hwei Tan Darko Marinov Lin Tan Gary T. Leavens University of Illinois University of Illinois University of Waterloo University of Central Florida 1 /* * Returns a synchronized map backed by the given
More informationProgramming with Contracts. Juan Pablo Galeotti, Alessandra Gorla Saarland University, Germany
Programming with Contracts Juan Pablo Galeotti, Alessandra Gorla Saarland University, Germany Contract A (formal) agreement between Method M (callee) Callers of M Rights Responsabilities Rights Responsabilities
More informationCSE wi Midterm Exam 2/8/18. Name UW ID #
Name UW ID # There are 11 questions worth a total of 120 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,
More informationpublic static void negate2(list<integer> t)
See the 2 APIs attached at the end of this worksheet. 1. Methods: Javadoc Complete the Javadoc comments for the following two methods from the API: (a) / @param @param @param @return @pre. / public static
More informationAssertions, pre/postconditions
Programming as a contract Assertions, pre/postconditions Assertions: Section 4.2 in Savitch (p. 239) Specifying what each method does q Specify it in a comment before method's header Precondition q What
More informationPart II. Hoare Logic and Program Verification. Why specify programs? Specification and Verification. Code Verification. Why verify programs?
Part II. Hoare Logic and Program Verification Part II. Hoare Logic and Program Verification Dilian Gurov Props: Models: Specs: Method: Tool: safety of data manipulation source code logic assertions Hoare
More informationpublic static boolean isoutside(int min, int max, int value)
See the 2 APIs attached at the end of this worksheet. 1. Methods: Javadoc Complete the Javadoc comments for the following two methods from the API: (a) / @param @param @param @return @pre. / public static
More informationOutline for Today CSE 142. CSE142 Wi03 G-1. withdraw Method for BankAccount. Class Invariants
CSE 142 Outline for Today Conditional statements if Boolean expressions Comparisons (=,!=, ==) Boolean operators (and, or, not - &&,,!) Class invariants Conditional Statements & Boolean Expressions
More informationCSE 307: Principles of Programming Languages
CSE 307: Principles of Programming Languages Advanced Topics R. Sekar Topics 1 / 14 1. 2 / 14 Section 1 3 / 14 Semantics of Programs Syntax defines what programs are valid. Semantics defines what the valid
More informationMethod Description for Semla A Software Design Method with a Focus on Semantics
Computer Science Method Description for Semla A Software Design Method with a Focus on Semantics Semla for Java, English version May 2000 Method Description for Semla A Software Design Method with a Focus
More informationAssertions. Assertions - Example
References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 11/13/2003 1 Assertions Statements about input to a routine or state of a class Have two primary roles As documentation,
More informationWhy Design by Contract! CS 619 Introduction to OO Design and Development. Design by Contract. Fall 2012
Why Design by Contract What s the difference with Testing? CS 619 Introduction to OO Design and Development Design by Contract Fall 2012 Testing tries to diagnose (and cure) defects after the facts. Design
More informationCode verification. CSE 331 University of Washington. Michael Ernst
Code verification CSE 331 University of Washington Michael Ernst Specification and verification To find an error, compare two things Mental model Verification Specification Program Example input & output
More informationDocumen(ng code, Javadoc, Defensive Programming, Asserts, Excep(ons & Try/Catch
Documen(ng code, Javadoc, Defensive Programming, Asserts, Excep(ons & Try/Catch 1 Most important reason to comment A) To summarize the code B) To explain how the code works C) To mark loca(ons that need
More informationSo far. Specifications, conclusion. Abstract Data Types (ADTs) Comparison by Logical Formulas. Outline
So far Specifications, conclusion. Abstract Data Types (ADTs) Based on notes by Michael Ernst, University of Washington Specifications Benefits of specifications Specification conventions Javadoc JML/Dafny
More informationOutline. iterator review iterator implementation the Java foreach statement testing
Outline iterator review iterator implementation the Java foreach statement testing review: Iterator methods a Java iterator only provides two or three operations: E next(), which returns the next element,
More informationRecap. Juan Pablo Galeotti,Alessandra Gorla, Software Engineering Chair Computer Science Saarland University, Germany
Recap Juan Pablo Galeotti,Alessandra Gorla, Software Engineering Chair Computer Science Saarland University, Germany 30% projects (10% each) At least 50% threshold for exam admittance Groups of 2 70% final
More informationAn Annotated Language
Hoare Logic An Annotated Language State and Semantics Expressions are interpreted as functions from states to the corresponding domain of interpretation Operators have the obvious interpretation Free of
More informationSpecifications. CSE 331 Spring 2010
Specifications CSE 331 Spring 2010 The challenge of scaling software Small programs are simple and malleable easy to write easy to change Big programs are (often) complex and inflexible hard to write hard
More informationCSE 331. Programming by contract: pre/post conditions; Javadoc
CSE 331 Programming by contract: pre/post conditions; Javadoc slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/ 1
More informationStatic program checking and verification
Chair of Software Engineering Software Engineering Prof. Dr. Bertrand Meyer March 2007 June 2007 Slides: Based on KSE06 With kind permission of Peter Müller Static program checking and verification Correctness
More informationClasses, interfaces, & documentation. Review of basic building blocks
Classes, interfaces, & documentation Review of basic building blocks Objects Data structures literally, storage containers for data constitute object knowledge or state Operations an object can perform
More informationn Specifying what each method does q Specify it in a comment before method's header n Precondition q Caller obligation n Postcondition
Programming as a contract Assertions, pre/postconditions and invariants Assertions: Section 4.2 in Savitch (p. 239) Loop invariants: Section 4.5 in Rosen Specifying what each method does q Specify it in
More informationRepresentation Invariants and Abstraction Functions
Representation Invariants and Abstraction Functions Outline Reasoning about ADTs Representation invariants (rep invariants) Representation exposure Checking rep invariants Abstraction functions CSCI 2600
More informationLinked Lists. College of Computing & Information Technology King Abdulaziz University. CPCS-204 Data Structures I
College of Computing & Information Technology King Abdulaziz University CPCS-204 Data Structures I What are they? Abstraction of a list: i.e. a sequence of nodes in which each node is linked to the node
More informationChecking Program Properties with ESC/Java
Checking Program Properties with ESC/Java 17-654/17-765 Analysis of Software Artifacts Jonathan Aldrich 1 ESC/Java A checker for Java programs Finds null pointers, array dereferences Checks Hoare logic
More informationCS 170 Java Programming 1. Week 13: Classes, Testing, Debugging
CS 170 Java Programming 1 Week 13: Classes, Testing, Debugging What s the Plan? Short lecture for makeup exams Topic 1: A Little Review How to create your own user-defined classes Defining instance variables,
More informationThe Java Modeling Language JML
The Java Modeling Language JML Néstor Cataño ncatano@puj.edu.co Faculty of Engineering Pontificia Universidad Javeriana The Java Modelling Language JML p.1/47 Lecture Plan 1. An Introduction to JML 2.
More informationContract Programming For C++0x
Contract Programming For C++0x WG21/N1800 and J16/05-0060 Lawrence Crowl and Thorsten Ottosen lawrence.crowl@sun.com and nesotto@cs.aau.dk 2005-04-27 Overview This is an annotated version of the presentation
More informationCSE wi Midterm Exam 2/8/18 Sample Solution
Remember: For all of the questions involving proofs, assertions, invariants, and so forth, you should assume that all numeric quantities are unbounded integers (i.e., overflow can not happen) and that
More informationCSE 331 Software Design & Implementation
CSE 331 Software Design & Implementation Kevin Zatloukal Summer 2017 Lecture 5 Specifications (Based on slides by Mike Ernst, Dan Grossman, David Notkin, Hal Perkins, Zach Tatlock) Reminders HW2 is due
More information5. Defining Classes and Methods
5. Defining Classes and Methods Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich http://seal.ifi.uzh.ch/info1 Objectives Describe and define concepts of class, class object Describe use
More informationECSE 321 Assignment 2
ECSE 321 Assignment 2 Instructions: This assignment is worth a total of 40 marks. The assignment is due by noon (12pm) on Friday, April 5th 2013. The preferred method of submission is to submit a written
More informationLecture 4 Specifications
CSE 331 Software Design and Implementation Administrivia Next assignments posted tonight HW2: Written problems on loops Lecture 4 Specifications Readings posted as well! Quizzes coming soon J Zach Tatlock
More informationExploiting Synergy Between Testing and Inferred Partial Specifications
Exploiting Synergy Between Testing and Inferred Partial Specifications Tao Xie David Notkin Department of Computer Science & Engineering, University of Washington {taoxie, notkin}@cs.washington.edu Technical
More informationFormal Specification and Verification
Formal Specification and Verification Formal Specification, Part III Bernhard Beckert Adaptation of slides by Wolfgang Ahrendt Chalmers University, Gothenburg, Sweden Formal Specification and Verification:
More informationQueues. CITS2200 Data Structures and Algorithms. Topic 5
CITS2200 Data Structures and Algorithms Topic 5 Queues Implementations of the Queue ADT Queue specification Queue interface Block (array) representations of queues Recursive (linked) representations of
More informationReferences: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 10/14/2004 1
References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 10/14/2004 1 Assertions Statements about input to a routine or state of a class Have two primary roles As documentation,
More informationChapter 3 (part 3) Describing Syntax and Semantics
Chapter 3 (part 3) Describing Syntax and Semantics Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the Meanings
More informationUnit 9 Practice Test (AB27-30)
Unit 9 Practice Test (AB27-30) Name 1. Consider the following method: public static int checktree(treenode root) return 0; int x = checktree(root.getleft()); if ( x >= 0 && checktree(root.getright()) ==
More informationDefining Classes and Methods. Objectives. Objectives 6/27/2014. Chapter 5
Defining Classes and Methods Chapter 5 Objectives Describe concepts of class, class object Create class objects Define a Java class, its methods Describe use of parameters in a method Use modifiers public,
More informationCSE 331 Final Exam 6/5/17. Name UW ID#
Name UW ID# There are 10 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,
More informationMining Specifications
Mining Specifications Andreas Zeller Saarland University zeller@acm.org WINNER OF JOLT PRODUCTIVITY AWARD ANDREAS ZELLER WHY PROGRAMS FAIL A GUIDE TO SYSTEMATIC DEBUGGING SECOND EDITION FOSE 10 FSE 10
More informationShared Variables and Interference
Illinois Institute of Technology Lecture 24 Shared Variables and Interference CS 536: Science of Programming, Spring 2018 A. Why Parallel programs can coordinate their work using shared variables, but
More informationAssignment 5. Introduction
Assignment 5 Introduction The objectives of this assignment are to exercise a few advanced object oriented programming and basic data structures concepts. The first mini-goal is to understand that objects
More informationAn Empirical Comparison of Automated Generation and Classification Techniques for Object-Oriented Unit Testing
An Empirical Comparison of Automated Generation and Classification Techniques for Object-Oriented Unit Testing Marcelo d Amorim (UIUC) Carlos Pacheco (MIT) Tao Xie (NCSU) Darko Marinov (UIUC) Michael D.
More informationA Semantic Framework for the Retrieval and Execution of Open Source Code
A Semantic Framework for the Retrieval and Execution of Open Source Code Mattia Atzeni and Maurizio Atzori Università degli Studi di Cagliari Problem Statement We introduce an unsupervised approach to
More informationObject Oriented Program Correctness with OOSimL
Kennesaw State University DigitalCommons@Kennesaw State University Faculty Publications 12-2009 Object Oriented Program Correctness with OOSimL José M. Garrido Kennesaw State University, jgarrido@kennesaw.edu
More informationSemantics. There is no single widely acceptable notation or formalism for describing semantics Operational Semantics
There is no single widely acceptable notation or formalism for describing semantics Operational Describe the meaning of a program by executing its statements on a machine, either simulated or actual. The
More informationCS350: Data Structures Stacks
Stacks James Moscola Department of Engineering & Computer Science York College of Pennsylvania James Moscola Stacks Stacks are a very common data structure that can be used for a variety of data storage
More informationAn Introduction To Software Agitation
An Introduction To Software Agitation Alberto Savoia Chief Technology Officer Agitar Software Inc. www.agitar.com java.sun.com/javaone/sf Agenda The Developer Testing Revolution Four Types of Tests Software
More informationObjectives. Defining Classes and Methods. Objectives. Class and Method Definitions: Outline 7/13/09
Objectives Walter Savitch Frank M. Carrano Defining Classes and Methods Chapter 5 Describe concepts of class, class object Create class objects Define a Java class, its methods Describe use of parameters
More informationFormale Entwicklung objektorientierter Software
Formale Entwicklung objektorientierter Software Praktikum im Wintersemester 2008/2009 Prof. P. H. Schmitt Christian Engel, Benjamin Weiß Institut für Theoretische Informatik Universität Karlsruhe 5. November
More informationAbstract Data Types Chapter 1
Abstract Data Types Chapter 1 Part Two Bags A bag is a basic container like a shopping bag that can be used to store collections. There are several variations: simple bag grab bag counting bag 2 Bag ADT
More informationEXAMINATIONS 2009 MID-TERM TEST. COMP 202 / SWEN 202 Formal Methods of Computer Science / Formal Foundations of Software Engineering WITH ANSWERS
T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON Time Allowed: 90 minutes EXAMINATIONS 2009 MID-TERM TEST COMP 202 / SWEN 202 Formal Methods
More informationComparing procedure specifications
Comparing procedure specifications CSE 331 University of Washington Michael Ernst Outline Satisfying a specification; substitutability Stronger and weaker specifications Comparing by hand Comparing via
More informationSemantic Analysis. CSE 307 Principles of Programming Languages Stony Brook University
Semantic Analysis CSE 307 Principles of Programming Languages Stony Brook University http://www.cs.stonybrook.edu/~cse307 1 Role of Semantic Analysis Syntax vs. Semantics: syntax concerns the form of a
More informationShared Variables and Interference
Solved Shared Variables and Interference CS 536: Science of Programming, Fall 2018 A. Why Parallel programs can coordinate their work using shared variables, but it s important for threads to not interfere
More informationTesting Library Specifications by Verifying Conformance Tests
Testing Library Specifications by Verifying Conformance Tests Joseph R. Kiniry, Daniel M. Zimmerman, Ralph Hyland ITU Copenhagen, UW Tacoma, UCD Dublin 6th International Conference on Tests & Proofs Prague,
More informationAutomatic Repair of Real Bugs in Java: A Large-Scale Experiment on the Defects4J Dataset
Automatic Repair of Real Bugs in Java: A Large-Scale Experiment on the Defects4J Dataset Matias Martinez, Thomas Durieux, Romain Sommerard, Jifeng Xuan, Martin Monperrus 1 Automatic Software Repair Automatic
More informationCombined Static and Dynamic Automated Test Generation
Combined Static and Dynamic Automated Test Generation Sai Zhang University of Washington Joint work with: David Saff, Yingyi Bu, Michael D. Ernst 1 Unit Testing for Object-oriented Programs Unit test =
More informationAssignment 4 Publication date: 27/12/2015 Submission date: 17/01/ :59 People in-charge: R. Mairon and Y. Twitto
Assignment 4 Publication date: 27/12/2015 Submission date: 17/01/2016 23:59 People in-charge: R. Mairon and Y. Twitto Introduction The objectives of this assignment are to exercise a few advanced object
More informationDefining Classes and Methods
Walter Savitch Frank M. Carrano Defining Classes and Methods Chapter 5 ISBN 0136091113 2009 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Objectives Describe concepts of class, class
More informationCSE 331 Midterm Exam 2/13/12
Name There are 10 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes, closed
More informationConnecting with Computer Science, 2e. Chapter 15 Programming II
Connecting with Computer Science, 2e Chapter 15 Programming II Objectives In this chapter you will: Gain an understanding of the basics of high-level programming languages, using Java and C++ as examples
More informationExam 1 CSCI 2600 Principles of Software October 6, 2015
NAME Exam 1 CSCI 2600 Principles of Software October 6, 2015 - DO NOT OPEN THIS EXAM UNTIL TOLD TO DO SO! - READ THROUGH THE ENTIRE EXAM BEFORE STARTING TO WORK. - YOU ARE ALLOWED ONLY 2 CHEAT PAGES. NO
More informationVerification Conditions. Juan Pablo Galeotti, Alessandra Gorla, Andreas Rau Saarland University, Germany
Verification Conditions Juan Pablo Galeotti, Alessandra Gorla, Andreas Rau Saarland University, Germany 30% projects (10% each) At least 50% threshold for exam admittance Groups of 2 70% final exam (see
More informationPostfix Notation is a notation in which the operator follows its operands in the expression (e.g ).
Assignment 5 Introduction For this assignment, you will write classes to evaluate arithmetic expressions represented as text. For example, the string "1 2 ( * 4)" would evaluate to 15. This process will
More informationLecture 10 Design by Contract
CS 5959 Writing Solid Code Fall 2015 Nov-23 Lecture 10 Design by Contract Zvonimir Rakamarić University of Utah Design by Contract Also called assume-guarantee reasoning Developers annotate software components
More informationESC/Java2 vs. JMLForge. Juan Pablo Galeotti, Alessandra Gorla, Andreas Rau Saarland University, Germany
ESC/Java2 vs. JMLForge Juan Pablo Galeotti, Alessandra Gorla, Andreas Rau Saarland University, Germany ESC/Java2: the formula is built using Dijsktra s Weakes precondition. Automatic theorem prover: Simplify
More informationAnnouncements. Representation Invariants and Abstraction Functions. Announcements. Outline
Announcements Representation Invariants and Abstraction Functions Exam 1 on Monday Feb. 26 th Closed book/phone/laptop, 2 cheat pages allowed Reasoning about code, Specifications, ADTs I will post Review
More informationData Abstraction and Specification of ADTs
CITS2200 Data Structures and Algorithms Topic 4 Data Abstraction and Specification of ADTs Example The Reversal Problem and a non-adt solution Data abstraction Specifying ADTs Interfaces javadoc documentation
More informationBasics of Java: Expressions & Statements. Nathaniel Osgood CMPT 858 February 15, 2011
Basics of Java: Expressions & Statements Nathaniel Osgood CMPT 858 February 15, 2011 Java as a Formal Language Java supports many constructs that serve different functions Class & Interface declarations
More informationCS 146 Spring 2017 Homework 4 Sections 5 and 6. The homework assignment is available at:
The homework assignment is available at: http://www.jennylam.cc/courses/146-s17/homework04.html 1. Here is a working Java solution which runs in linear time in the total length of the input lists. /**
More informationFormal methods What are they? Uses Tools Application to software development
FormalMethods Page 1 Formal methods introduction 9:26 PM Formal methods What are they? Uses Tools Application to software development FormalMethods Page 2 What are formal methods? 9:49 PM Do you have any
More informationCS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM
CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM Objectives Defining a wellformed method to check class invariants Using assert statements to check preconditions,
More informationJML and Aspects: The Benefits of
JML and Aspects: The Benefits of Instrumenting JML Features with AspectJ Henrique Rebêlo Sérgio Soares Ricardo Lima Paulo Borba Márcio Cornélio Java Modeling Language Formal specification language for
More informationUtilities (Part 3) Implementing static features
Utilities (Part 3) Implementing static features 1 Goals for Today learn about preconditions versus validation introduction to documentation introduction to testing 2 Yahtzee class so far recall our implementation
More informationLab & Assignment 1. Lecture 3: ArrayList & Standard Java Graphics. Random Number Generator. Read Lab & Assignment Before Lab Wednesday!
Lab & Assignment 1 Lecture 3: ArrayList & Standard Java Graphics CS 62 Fall 2015 Kim Bruce & Michael Bannister Strip with 12 squares & 5 silver dollars placed randomly on the board. Move silver dollars
More informationITI Introduction to Computing II
ITI 1121. Introduction to Computing II Iterator 1 (part I) Marcel Turcotte School of Electrical Engineering and Computer Science Version of March 24, 2013 Abstract These lecture notes are meant to be looked
More informationCSE 331 Midterm Exam Sample Solution 2/18/15
Question 1. (10 points) (Forward reasoning) Using forward reasoning, write an assertion in each blank space indicating what is known about the program state at that point, given the precondition and the
More informationChap 6. Test Models and Strategies
Chap 6. Test Models and Strategies 6.2 State-based Testing 1. Introduction 2. State Transition Diagram 3. Transition Test Strategy 1 1. Introduction -State-based testing relies on the construction of a
More informationCSE331 Winter 2014, Midterm Examination February 12, 2014
CSE331 Winter 2014, Midterm Examination February 12, 2014 Please do not turn the page until 10:30. Rules: The exam is closed-book, closed-note, etc. Please stop promptly at 11:20. There are 100 points
More informationCSE 331 Midterm Exam 11/9/15 Sample Solution
Remember: For all of the questions involving proofs, assertions, invariants, and so forth, you should assume that all numeric quantities are unbounded integers (i.e., overflow can not happen) and that
More informationCSI33 Data Structures
Outline Department of Mathematics and Computer Science Bronx Community College October 25, 2017 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers Function Details Assert Statements
More informationTutorial 11. Exercise 1: CSC111 Computer Programming I. A. Write a code snippet to define the following arrays:
College of Computer and Information Sciences CSC111 Computer Programming I Exercise 1: Tutorial 11 Arrays: A. Write a code snippet to define the following arrays: 1. An int array named nums of size 10.
More informationEXAMINATIONS 2009 END-OF-YEAR. COMP 202 / SWEN 202 Formal Methods of Computer Science / Formal Foundations of Software Engineering
T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON EXAMINATIONS 2009 END-OF-YEAR COMP 202 / SWEN 202 Formal Methods of Computer Science / Formal
More informationLecture 24: Loop Invariants
http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 24: Loop Invariants [Online Reading] CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van
More informationQueue Implemented with a CircularArray. Queue Implemented with a CircularArray. Queue Implemented with a CircularArray. Thursday, April 25, 13
Queue Implemented with 1 2 numitems = enqueue (); 1 Queue Implemented with 2 numitems = 2 enqueue (); enqueue (); 2 Queue Implemented with 2 numitems = 2 enqueue (); enqueue (); enqueue (5); enqueue (6);
More informationHoare Logic: Proving Programs Correct
Hoare Logic: Proving Programs Correct 17-654/17-765 Analysis of Software Artifacts Jonathan Aldrich Reading: C.A.R. Hoare, An Axiomatic Basis for Computer Programming Some presentation ideas from a lecture
More informationCMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics
Recall Architecture of Compilers, Interpreters CMSC 330: Organization of Programming Languages Source Scanner Parser Static Analyzer Operational Semantics Intermediate Representation Front End Back End
More information6. Operatoren. 7. Safe Programming: Assertions. Table of Operators. Table of Operators - Explanations. Tabular overview of all relevant operators
6. Operatoren Tabular overview of all relevant operators 180 Table of Operators Description Operator Arity Precedence Associativity Object member access. 2 16 left Array access [ ] 2 16 left Method invocation
More informationPoints off Total off Net Score. CS 314 Final Exam Spring 2016
Points off 1 2 3 4 5 6 Total off Net Score CS 314 Final Exam Spring 2016 Your Name Your UTEID Instructions: 1. There are 6 questions on this test. 100 points available. Scores will be scaled to 300 points.
More informationCS 3 Introduction to Software Engineering. 5: Iterators
CS 3 Introduction to Software Engineering 5: Iterators Questions? 2 PS1 Discussion Question You are to choose between two procedures, both of which compute the minimum value in an array of integers. One
More informationSoftware Specifications. CMSC 433 Programming Language Technologies and Paradigms Spring Specifications Help You Write Code
Software Specifications CMSC 433 Programming Language Technologies and Paradigms Spring 2007 Documentation Feb. 20, 2007 A specification defines the behavior of an abstraction This is the contract between
More informationBinary Search. Not your parents binary search. Ethan Arnold, Arnav Sastry. Spring 2017 CS 104C
Binary Search Not your parents binary search Ethan Arnold, Arnav Sastry CS 104C Spring 2017 1 / 10 How to write binary search Java: 2 / 10 How to write binary search Java: Collections.binarySearch(list,
More information+! Today. Lecture 3: ArrayList & Standard Java Graphics 1/26/14! n Reading. n Objectives. n Reminders. n Standard Java Graphics (on course webpage)
+! Lecture 3: ArrayList & Standard Java Graphics +! Today n Reading n Standard Java Graphics (on course webpage) n Objectives n Review for this week s lab and homework assignment n Miscellanea (Random,
More information