Gradual Programming: Bridging the Semantic Gap Bor-Yuh Evan Chang Bor-Yuh Evan Chang Amer Diwan Jeremy G. Siek University of Colorado, Boulder PLDI FIT.

Slides:



Advertisements
Similar presentations
Transparency No. 1 Java Collection API : Built-in Data Structures for Java.
Advertisements

Sequence of characters Generalized form Expresses Pattern of strings in a Generalized notation.
Modular and Verified Automatic Program Repair Francesco Logozzo, Thomas Ball RiSE - Microsoft Research Redmond.
Identity and Equality Based on material by Michael Ernst, University of Washington.
Problem Solving 5 Using Java API for Searching and Sorting Applications ICS-201 Introduction to Computing II Semester 071.
Systems Software.
Data Abstraction II SWE 619 Software Construction Last Modified, Spring 2009 Paul Ammann.
CSM-Java Programming-I Spring,2005 Exceptions Lesson - 7.
Quiz3! Midterm! Assignment2! (most) Quiz4! Today’s special: 4 for 1.
Reduction in End-User Shape Analysis Dagstuhl - Typing, Analysis, and Verification of Heap-Manipulating Programs – July 24, 2009 Xavier Rival INRIA and.
End-User Shape Analysis National Taiwan University – August 11, 2009 Xavier Rival INRIA/ENS Paris Bor-Yuh Evan Chang 張博聿 U of Colorado, Boulder If some.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 52 Database Systems I Relational Algebra.
Lecture #4 Agenda Cell phones off & name signs out Review Questions? Objects The birds-and-the-bees talk.
Recommendation: Play the game and attempt to answer the questions yourself without looking at the answers. You’ll learn much less if you just look at the.
From last time S1: l := new Cons p := l S2: t := new Cons *p := t p := t l p S1 l p tS2 l p S1 t S2 l t S1 p S2 l t S1 p S2 l t S1 p L2 l t S1 p S2 l t.
1 Ivan Lanese Computer Science Department University of Bologna Italy Concurrent and located synchronizations in π-calculus.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
Generative Programming. Generic vs Generative Generic Programming focuses on representing families of domain concepts Generic Programming focuses on representing.
Abstraction: Polymorphism, pt. 1 Abstracting Objects.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Unified Modeling Language
CSC 8310 Programming Languages Meeting 2 September 2/3, 2014.
SEG4110 – Advanced Software Design and Reengineering TOPIC G Java Collections Framework.
1 Identifiers  Identifiers are the words a programmer uses in a program  An identifier can be made up of letters, digits, the underscore character (
Comp 245 Data Structures Software Engineering. What is Software Engineering? Most students obtain the problem and immediately start coding the solution.
CIS Computer Programming Logic
Java Language and SW Dev’t
Data Structures and Abstract Data Types "Get your data structures correct first, and the rest of the program will write itself." - David Jones.
The Java Programming Language
SWE 619 © Paul Ammann Procedural Abstraction and Design by Contract Paul Ammann Information & Software Engineering SWE 619 Software Construction cs.gmu.edu/~pammann/
TECH Computer Science NP-Complete Problems Problems  Abstract Problems  Decision Problem, Optimal value, Optimal solution  Encodings  //Data Structure.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
1/20/03A2-1 CS494 Interfaces and Collection in Java.
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
Prolog Program Style (ch. 8) Many style issues are applicable to any program in any language. Many style issues are applicable to any program in any language.
Collections Data structures in Java. OBJECTIVE “ WHEN TO USE WHICH DATA STRUCTURE ” D e b u g.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
Programmeren 1 6 september 2010 HOORCOLLEGE 2: INTERACTIE EN CONDITIES PROGRAMMEREN 1 6 SEPTEMBER 2009 Software Systems - Programming - Week.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Week 9 - Friday.  What did we talk about last time?  Collisions  Open addressing ▪ Linear probing ▪ Quadratic probing ▪ Double hashing  Chaining.
Written by: Dr. JJ Shepherd
Slides prepared by Rose Williams, Binghamton University Chapter 16 Collections and Iterators.
(c) University of Washington10-1 CSC 143 Java Errors and Exceptions Reading: Ch. 15.
Faithful mapping of model classes to mathematical structures Ádám Darvas ETH Zürich Switzerland Peter Müller Microsoft Research Redmond, WA, USA SAVCBS.
Collections Dwight Deugo Nesa Matic
Design Pattern Support based on principles of model driven development Zihao Zhao.
Exception and Exception Handling. Exception An abnormal event that is likely to happen during program is execution Computer could run out of memory Calling.
© 2011 Pearson Education, publishing as Addison-Wesley Chapter 1: Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science.
Software Design and Development Development Methodoligies Computing Science.
Artificial Intelligence Logical Agents Chapter 7.
Sixth Lecture ArrayList Abstract Class and Interface
EECE 310: Software Engineering
Abstraction and Refinement for Large Scale Model Checking
Unified Modeling Language
Efficiency of in Binary Trees
Week 8 - Friday CS221.
Application Development Theory
Searching.
Relational Algebra Chapter 4, Part A
Is “Higher Level” Better?
null, true, and false are also reserved.
Chapter 1: Computer Systems
Relational Algebra Chapter 4, Sections 4.1 – 4.2
Introduction to Data Structure
„Lambda expressions, Optional”
Presentation transcript:

Gradual Programming: Bridging the Semantic Gap Bor-Yuh Evan Chang Bor-Yuh Evan Chang Amer Diwan Jeremy G. Siek University of Colorado, Boulder PLDI FIT 2009

2 Have you noticed a time where your program is not optimized where you expect? Bor-Yuh Evan Chang, Amer Diwan, and Jeremy G. Siek - Gradual Programming “I need a map data structure ” Load class file Run class initialization Create hashtable Load class file Run class initialization Create hashtable Problem Problem: Tools (IDEs, checkers, optimizers) have no knowledge of what the programmer cares about … hampering programmer productivity, software reliability, and execution efficiency semantic gap Observation Observation: A disconnect between programmer intent and program meaning

3 Example: Iteration Order class OpenArray extends Object { private Double data[]; public boolean contains(Object lookFor) { for (i = 0; i < data.length; i++) { if (data[i].equals(lookFor)) return true; } return false; } } Bor-Yuh Evan Chang, Amer Diwan, and Jeremy G. Siek - Gradual Programming parallel Compiler cannot choose a different iteration order (e.g., parallel) class OpenArray extends Object { private Double data[]; public boolean contains(Object lookFor) { for (i = 0; i < data.length; i++) { if (data[i].equals(lookFor)) return true; } return false; } Must specify an iteration order Must specify an iteration order even when it should not matter

4 Wild and Crazy Idea: Use Non-Determinism Programmer starts with a potentially non-deterministic program Analysis identifies instances of “under- determinedness” Programmer eliminates “under- determinedness” Bor-Yuh Evan Chang, Amer Diwan, and Jeremy G. Siek - Gradual Programming class OpenArray extends Object { private Double data[]; public boolean contains(Object lookFor) { for (i = 0; i < data.length; i++) { if (data[i].equals(lookFor)) return true; } return false; } class OpenArray extends Object { private Double data[]; public boolean contains(Object lookFor) { for (i = 0; i < data.length; i++) { if (data[i].equals(lookFor)) return true; } return false; } class OpenArray extends Object { private Double data[]; public boolean contains(Object lookFor) {  i  0.. data.length-1 { if (data[i].equals(lookFor)) return true; } return false; } class OpenArray extends Object { private Double data[]; public boolean contains(Object lookFor) {  i  0.. data.length-1 { if (data[i].equals(lookFor)) return true; } return false; } “over-determined” “under-determined” just right starting point Question Question: What does this mean? Is it “under-determined”? Response Response: Depends, is the iteration order important? Question Question: What does this mean? Is it “under-determined”? Response Response: Depends, is the iteration order important?

5 Let’s try a few program variants Bor-Yuh Evan Chang, Amer Diwan, and Jeremy G. Siek - Gradual Programming public boolean contains(Object lookFor) { for (i = data.length-1; i >= 0; i--) { if (data[i].equals(lookFor)) return true; } return false; } public boolean contains(Object lookFor) { for (i = data.length-1; i >= 0; i--) { if (data[i].equals(lookFor)) return true; } return false; } public boolean contains(Object lookFor) { for (i = 0; i < data.length; i++) { if (data[i].equals(lookFor)) return true; } return false; } public boolean contains(Object lookFor) { for (i = 0; i < data.length; i++) { if (data[i].equals(lookFor)) return true; } return false; } public boolean contains(Object lookFor) { parallel_for (0, data.length-1) i => { if (data[i].equals(lookFor)) return true; } return false; } public boolean contains(Object lookFor) { parallel_for (0, data.length-1) i => { if (data[i].equals(lookFor)) return true; } return false; } Do they compute the same result? Approach Approach: Try to verify equivalence of program variants up to a specification Yes  Pick any one No  Ask user Yes  Pick any one No  Ask user What about here?

6 Surprisingly, analysis says no. Why? Exceptions! Bor-Yuh Evan Chang, Amer Diwan, and Jeremy G. Siek - Gradual Programming Need user interaction to refine specification that captures programmer intent null a.data = a.contains( ) left-to-right iteration returns true right-to-left iteration throws NullPointerException

7 Scary Proposal? “Fix semantics per program”: Abstract constructs with many possible concrete implementations Apply program analysis to find inconsistent implementations Interact with the user to refine the specification Language designer role can enumerate the possible implementations Bor-Yuh Evan Chang, Amer Diwan, and Jeremy G. Siek - Gradual Programming

8 Bridging the Semantic Gap Bor-Yuh Evan Chang, Amer Diwan, and Jeremy G. Siek - Gradual Programming “I need a map data structure ” “Looks like iterator order matters for your program” “Yes, I need iteration in sorted order” “Let’s use a balanced binary tree (TreeMap)”