Tutorial Pex4Fun: Teaching and Learning Computer Science via Social Gaming Nikolai Tillmann, Jonathan de Halleux, Judith Bishop, Michal.

Slides:



Advertisements
Similar presentations
Bounded Model Checking of Concurrent Data Types on Relaxed Memory Models: A Case Study Sebastian Burckhardt Rajeev Alur Milo M. K. Martin Department of.
Advertisements

Program Verification Using the Spec# Programming System ETAPS Tutorial K. Rustan M. Leino, Microsoft Research, Redmond Rosemary Monahan, NUIM Maynooth.
Leonardo de Moura Microsoft Research. Z3 is a new solver developed at Microsoft Research. Development/Research driven by internal customers. Free for.
TouchDevelop: Productive Scripting on and for Mobile Devices and Web Services Thomas Ball Sebastian Burckhardt, Peli de Halleux, Michał Moskal, Nikolai.
Advanced topics in touchdevelop privacy transparent privacy control via information flow analysis Disclaimer: This document is provided “as-is”. Information.
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Automatic test case generation for programs that are coded against interfaces and annotations or use native code Mainul Islam Supervisor: Dr. Christoph.
1 Symbolic Execution for Model Checking and Testing Corina Păsăreanu (Kestrel) Joint work with Sarfraz Khurshid (MIT) and Willem Visser (RIACS)
Symbolic execution © Marcelo d’Amorim 2010.
Web Forms and ASP.NET Programming Right from the Start with Visual Basic.NET 1/e 12.
Pexxxx White Box Test Generation for
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2004 Project.
Michael Ernst, page 1 Improving Test Suites via Operational Abstraction Michael Ernst MIT Lab for Computer Science Joint.
Software Testing and QA Theory and Practice (Chapter 4: Control Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Finding Bugs in Web Applications Using Dynamic Test Generation and Explicit-State Model Checking -Shreyas Ravindra.
Java: Chapter 1 Computer Systems Computer Programming II Aug
Dr. Pedro Mejia Alvarez Software Testing Slide 1 Software Testing: Building Test Cases.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Introduction 01_intro.ppt
Chapter 2: Developing a Program Prelude to Programming Concepts and Design Copyright © 2001 Scott/Jones, Inc.. All rights reserved. 1 Chapter 2 Developing.
A Visual Interactive Tool For the Course “Automata and Formal Languages” Holon Institute of Technology Mark Trakhtenbrot, Vladimir Nodelman, Avi Lamai.
Deep Dive into Pex How Pex works, implications for design of Code Hunt puzzles Nikolai Tillmann Principal Software Engineering Manager Microsoft, Redmond,
Teach.NET Workshop Series Track 4: AP Computer Science with.NET and J#
© 2004 The MathWorks, Inc. 1 MATLAB for C/C++ Programmers Support your C/C++ development using MATLAB’s prebuilt graphics functions and trusted numerics.
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
Tao Xie North Carolina State University Supported by CACC/NSA Related projects supported in part by ARO, NSF, SOSI.
Tao Xie (North Carolina State University) Nikolai Tillmann, Jonathan de Halleux, Wolfram Schulte (Microsoft Research, Redmond WA, USA)
DySy: Dynamic Symbolic Execution for Invariant Inference.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Tao Xie Automated Software Engineering Group Department of Computer Science North Carolina State University
CS161 Topic #21 CS161 Introduction to Computer Science Topic #2.
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
Teaching and Learning Programming and Software Engineering via Interactive Gaming Tao Xie University of Illinois at Urbana-Champaign In collaboration with.
Visual Studio 2005 Team System: Building Robust & Reliable Software Tejasvi Kumar Technology Specialist - VSTS Microsoft Corporation
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Introduction to Software Testing. Types of Software Testing Unit Testing Strategies – Equivalence Class Testing – Boundary Value Testing – Output Testing.
Tao Xie North Carolina State University Nikolai Tillmann, Peli de Halleux, Wolfram Schulte Microsoft Research.
Code Contracts Parameterized Unit Tests Tao Xie. Example Unit Test Case = ? Outputs Expected Outputs Program + Test inputs Test Oracles 2 void addTest()
Parameterized Unit Tests By Nikolai Tillmann and Wolfram Schulte Proc. of ESEC/FSE 2005 Presented by Yunho Kim Provable Software Lab, KAIST TexPoint fonts.
Tao Xie (North Carolina State University) Peli de Halleux, Nikolai Tillmann, Wolfram Schulte (Microsoft Research)
CLIP Command Line InterPreter for a subset of C++.
Code Hunt: Experience with Coding Contests at Scale Judith Bishop, R Nigel Horspool, Tao Xie, Nikolai Tillmann, Jonathan de Halleux Microsoft Research,
The Software Development Process
Xusheng Xiao North Carolina State University CSC 720 Project Presentation 1.
Grigore Rosu Founder, President and CEO Professor of Computer Science, University of Illinois
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Comments, Conditional Statements Continued, and Loops Engineering 1D04, Teaching Session 4.
Writing Better C# Using C# 6 By: Mitchel Sellers.
Symbolic Execution in Software Engineering By Xusheng Xiao Xi Ge Dayoung Lee Towards Partial fulfillment for Course 707.
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
Control Flow Testing Handouts
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
Dynamic Symbolic Execution
Representation, Syntax, Paradigms, Types
Outline of the Chapter Basic Idea Outline of Control Flow Testing
runtime verification Brief Overview Grigore Rosu
Preliminary Analysis of Contestant Performance for a Code Hunt Contest
Code Contracts and Pex Peli de Halleux, Nikolai Tillmann
Assembler, Compiler, Interpreter
Use of Mathematics using Technology (Maltlab)
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1 Introduction(1.1)
Representation, Syntax, Paradigms, Types
Assembler, Compiler, Interpreter
BugHint: A Visual Debugger Based on Graph Mining
Representation, Syntax, Paradigms, Types
Basic Concepts of Algorithm
IS 135 Business Programming
Presentation transcript:

Tutorial Pex4Fun: Teaching and Learning Computer Science via Social Gaming Nikolai Tillmann, Jonathan de Halleux, Judith Bishop, Michal Moskal Microsoft Research Tao Xie NCSU

Pex4Fun: Teaching and Learning Computer Science via Social Gaming Agenda Background: Code Analysis by Dynamic Symbolic Execution Writing Code in a Browser Coding Duels Social Experience Teaching Platform Conclusion

DYNAMIC SYMBOLIC EXECUTION IN THE CLOUD Pex – The Pex4Fun Engine – History

Before the cloud…

void CoverMe(int[] a) { if (a == null) return; if (a.Length > 0) if (a[0] == ) throw new Exception("bug"); } a.Length>0 a[0]==123… T F T F F a==null T Constraints to solve a!=null a!=null && a.Length>0 a!=null && a.Length>0 && a[0]== Input null {} {0} {123…} Execute&Monitor Solve Choose next path Observed constraints a==null a!=null && !(a.Length>0) a==null && a.Length>0 && a[0]!= a==null && a.Length>0 && a[0]==  Generates test data systematically Done: There is no path left. Dynamic Symbolic Execution in Pex

Dynamic Symbolic Execution Exercises ArrayIndexLength Pex knows about all implicit, exception- throwing control-flow branches ArrayHeap Pex models the heap Assert, Assert123 Assertions connect code coverage and correctness

Limitations 16K characters of code (single file / editor window) * Single-threaded only No environment interactions * No non-determinism * Try to avoid floating-point computations * Limitation only applies to pex4fun.com, but not Pex tool

Dynamic Symbolic Execution Summary “Ask Pex” sends code to cloud Code is compiled and analyzed in cloud Dynamic Symbolic Execution automatically finds relevant interesting test inputs that achieve high code coverage Results are shown in browser

WRITING CODE IN A BROWSER Code Auto-Completion

Auto-Completion

Writing Code in Browser Exercise 1.Go to 2.Click “New” 3.Write some code with public static “Puzzle” method using System; class Vector { int x, y; public Vector(int x, int y) { this.x = x; this.y = y; } public int Length() { return (int)Math.Sqrt(x*x+y*y); } public Vector Normalize() { return new Vector(x/Length(), y/Length()); } public bool Equals(Vector other) { return this.x==other.x && this.y == other.y; } } public class Program { public static void Puzzle(Vector v) { var n1 = v.Normalize(); var n2 = n1.Normalize(); if (!n1.Equals(n2)) throw new Exception(“bug in normalize”); } } 4.“Ask Pex!”

Writing Code in Browser Summary Code is compiled in cloud Code is executed in cloud Auto-completion via cloud/Javascript in browser

CODING DUELS Fun and Engaging Serious Game – Win by Writing Code

Coding Duels

Pex computes “semantic diff” in cloud  code written in browser vs.  secret reference implementation You win when there are no differences secret

Coding Duels class VisibleProgram { public static int Puzzle1(int x) { return x; } class SecretProgram { public static int Puzzle2(int x) { return x * x; } public class MetaProgram { public static void Puzzle(int x) { if (VisibleProgram.Puzzle1(x) != SecretProgram.Puzzle2(x)) throw new System.Exception("mismatch!"); } class VisibleProgram { public static int Puzzle1(int x) { return x; } class SecretProgram { public static int Puzzle2(int x) { return x * x; } public class MetaProgram { public static void Puzzle(int x) { if (VisibleProgram.Puzzle1(x) != SecretProgram.Puzzle2(x)) throw new System.Exception("mismatch!"); }

Coding Duels Teaching Debugging/Problem Solving Skills From Hypothesis to Theorem – Step 1: Inference of hypothesized (delta) requirement When delta: Inference of failure-inducing conditions If difficult: forced generation of new data points – By adding data-point-fitting conditionals – Step 2: Writing of requirement-satisfying solution When delta: – Derivation of hypothesized faulty line(s) of code – Derivation of patches on the faculty line(s) of code – Step 3: “Ask Pex” to validate the hypothesis Initial almost-complete (delta) working implementation helps teach debugging skills

Coding Duels Teaching Abstraction Skills Step 1: Inference of hypothesized (delta) requirement from observed data points – Pattern recognition – Generalization from data points to formula – Inversion of constraint solving

Teaching Programming, Algorithm, and Program Understanding Skills Step 2: Writing of requirement-satisfying solution Many choices, e.g. recursion vs. loop implementation Teacher can give guidance: Providing hints in comments Providing initial almost-complete working implementation Teacher can give guidance: Providing hints in comments Providing initial almost-complete working implementation

Coding Duels Exercise 1.Go to optionally: sign in with Windows Live IDhttp://pex4fun.com 2.Click “New” 3.Write secret implementation with public static “Puzzle” method using System; public class Program { public static int Puzzle(int x, int y) { return x + y – 42; } } 4.“Ask Pex!” 5.Enter Coding Duel Name 6.Click “Turn This Puzzle Into A Coding Duel” 7.Open Permalink 8.Edit Description 9.Click “Permalink” 10.Use it, or create ulta-short version, e.g. with

Coding Duels Fun and Engaging Iterative gameplay Adaptive Personalized No cheating Clear winning criterion

Coding Duels Summary Coding Duel: write function that matches specification given by another implementation Semantic equivalence checked in cloud Student’s tasks: – Inference of hypothesized (delta) requirement – Writing of requirement-satisfying solution

SOCIAL EXPERIENCE Connecting Students – Competitive yet Self-Paced Environment

Social Experience

Social Experience Summary Community High score lists, leaderboard Live feed

PEX4FUN, A TEACHING PLATFORM Pages – Courses – Automated Assessments

Teaching

Teaching Summary How to become a teacher: – Sign in, choose nickname – Send us with nickname Teachers can – Create courses – Reuse existing or author existing pages – Get automated assessments of students – See students code

Outlook I Analyzing code submissions – Detecting duplicate submissions – Ranking submissions (how correct, how beautiful) – If faulty, give user guidance on “the next step”.

Outlook II Better code development experience – Debugging – Dynamic input/output table – More languages Beyond the web – Phone

More Reading Nikolai Tillmann, Jonathan de Halleux, and Tao Xie Pex for Fun: Engineering an Automated Testing Tool for Serious Games in Computer Science Microsoft Research, Technical report MSR-TR , March

Conclusion Taking programming into the browser, cloud –.NET: C# (with Intellisense), Visual Basic, F# – Execution, Code analysis with Pex Fun learning experience with Coding Duels Social experience: Live feed, sharing duels Teaching with automatic grading Create your own courses!