Semi-Automated SVG Programming via Direct Manipulation
Brian Hempel and Ravi Chugh
Semi-Automated SVG Programming via Direct Manipulation Brian Hempel - - PowerPoint PPT Presentation
Semi-Automated SVG Programming via Direct Manipulation Brian Hempel and Ravi Chugh Direct Manipulation 2 Direct Manipulation Drawing Documents And so many more 3 But not for one application 4 Programming 5 Programming 5
Brian Hempel and Ravi Chugh
Direct Manipulation
2
Direct Manipulation
Drawing Documents
And so many more…
3
But not for one application…
4
Programming
5
Programming
5
Programming
5
6
Program
6
Program
6
Program
6
Program Refactored Program
6
Program Refactored Program
Better for both experts and non-experts
7
DM
8
DM + Code
9
Existing Approach: DM + Code
10
Bret Victor, “Drawing Dynamic Visualizations”
Existing Approach: DM + Code
10
Bret Victor, “Drawing Dynamic Visualizations”
Existing Approach:
Toby Schachman, “Apparatus”
DM + Code
12
+ Code DM
12
+ Code DM
Our Approach: Code + DM
14
Chugh et al. [PLDI ’16]
Our Approach: Code + DM
15
Chugh et al. [PLDI ’16]
[PLDI ’16] Code First, Then DM
16
17
18
19
Draw
20
Draw Relate
21
Draw Relate Abstract
New DM Tools
22
Draw Relate Abstract
New DM Tools
23
Draw Relate Abstract
New DM Tools
24
Draw Relate Abstract
New DM Tools
25
Draw Relate Abstract
26
Draw Relate Abstract
Demo
27
Draw Relate Abstract
Demo
28
Draw Relate Abstract
29
Draw Relate Abstract
Sketch-n-Sketch
Programming in 2015
30
Draw Relate Abstract
Sketch-n-Sketch
Programming in 2015
30
Draw Relate Abstract
let rect1 = ... let line2 = ... let line3 = ...
Sketch-n-Sketch
Programming in 2015
30
Draw Relate Abstract
let rect1 = ... let line2 = ... let line3 = ...
Sketch-n-Sketch
Programming in 2015
31
Draw Relate Abstract
Sketch-n-Sketch
Programming in 2015
31
Draw Relate Abstract
let rect1_x = ... let rect1_y = ... let rect1 = ... let line2 = ... let line3 = ...
Sketch-n-Sketch
Programming in 2015
31
Draw Relate Abstract
let rect1_x = ... let rect1_y = ... let rect1 = ... let line2 = ... let line3 = ...
Sketch-n-Sketch
Programming in 2015
31
Draw Relate Abstract
let rect1_x = ... let rect1_y = ... let rect1 = ... let line2 = ... let line3 = ...
Sketch-n-Sketch
Programming in 2015
32
Draw Relate Abstract
Sketch-n-Sketch
Programming in 2015
32
Draw Relate Abstract
let group x y size = let rect1 = ... let line2 = ... let line3 = ... group 0 0 999999
Sketch-n-Sketch
Programming in 2015
32
Draw Relate Abstract
let group x y size = let rect1 = ... let line2 = ... let line3 = ... group 0 0 999999
Sketch-n-Sketch
Programming in 2015
32
Draw Relate Abstract
let group x y size = let rect1 = ... let line2 = ... let line3 = ... group 0 0 999999
Sketch-n-Sketch
Programming in 2015
32
Draw Relate Abstract
let group x y size = let rect1 = ... let line2 = ... let line3 = ... group 0 0 999999
Sketch-n-Sketch
Programming in 2015
33
Draw Relate Abstract
Sketch-n-Sketch
Programming in 2015
33
Draw Relate Abstract
Sketch-n-Sketch Sketch-n-Sketch++
34
Draw Relate Abstract
Sketch-n-Sketch Sketch-n-Sketch++
34
Draw Relate Abstract
(def polygon7_bot (+ (+ (* 0.5!... (def k3105 (/ (- (+ (- polygon6... (def polygon7_top (- (* 0.5! (+... (def [polygon5_right k3038] [(-... (def k3061 (/ (- (+ polygon5_ri... (def polygon6_bot (- (+ (- poly... (def k3063 (/ (- (+ polygon6_bo... (def polygon5_top (- polygon6_t... (def k3103 (/ (- (+ (- polygon5... (def [k3041 polygon5_bot] [(- p... (def k3134 (/ (- (+ k3041 helpe... (def k3141 (/ (- (+ k3038 helpe...
Sketch-n-Sketch Sketch-n-Sketch++
34
Draw Relate Abstract
(def polygon7_bot (+ (+ (* 0.5!... (def k3105 (/ (- (+ (- polygon6... (def polygon7_top (- (* 0.5! (+... (def [polygon5_right k3038] [(-... (def k3061 (/ (- (+ polygon5_ri... (def polygon6_bot (- (+ (- poly... (def k3063 (/ (- (+ polygon6_bo... (def polygon5_top (- polygon6_t... (def k3103 (/ (- (+ (- polygon5... (def [k3041 polygon5_bot] [(- p... (def k3134 (/ (- (+ k3041 helpe... (def k3141 (/ (- (+ k3038 helpe...
Sketch-n-Sketch
Smarter Algebra + Helper Functions
Sketch-n-Sketch++
35
Draw Relate Abstract
Sketch-n-Sketch Sketch-n-Sketch++
35
Draw Relate Abstract
; Top-Level Defs (def rect1 ...) (def line2 ...) (def line3 ...) ; Main Expression [ rect1 ... ]
Sketch-n-Sketch Sketch-n-Sketch++
36
Draw Relate Abstract
; Top-Level Defs (def rect1 ...) (def line2 ...) (def line3 ...) ; Main Expression [ rect1 ... ]
Sketch-n-Sketch Sketch-n-Sketch++
Refactor Programs
Structure
(def group1 (def rect1 ...) (def line2 ...) (def line3 ...) [ rect1 ... ] ) group1
37
Draw Relate Abstract
Sketch-n-Sketch Sketch-n-Sketch++
37
Draw Relate Abstract
Sketch-n-Sketch Sketch-n-Sketch++
37
Draw Relate Abstract
Sketch-n-Sketch Sketch-n-Sketch++
37
Draw Relate Abstract
Sketch-n-Sketch
Additional Interaction to Resolve User Intent
Sketch-n-Sketch++
38
Program
38
Program
38
Program
Domain-specific
38
Program
Domain-specific General
38
Program
Domain-specific General
38
Program
Domain-specific General
38
Program
Domain-specific General
38
Program
Domain-specific General
38
Program
Domain-specific General
38
Program
Domain-specific General
Related Work
39
Related Work
39
DM + Code DDV Apparatus
Related Work
39
Programming by Example Chimera Metamouse Mondrian DM + Code DDV Apparatus
Related Work
39
Programming by Example Chimera Metamouse Mondrian DM + Code DDV Apparatus Domain Apps Parametric CAD Procedural modeling
Related Work
Constraint Oriented Systems Sketchpad ThingLab Juno-2
39
Programming by Example Chimera Metamouse Mondrian DM + Code DDV Apparatus Domain Apps Parametric CAD Procedural modeling
Related Work
Constraint Oriented Systems Sketchpad ThingLab Juno-2
39
Programming by Example Chimera Metamouse Mondrian Code + DM Wang et al. Live PBE McDirmid’s Demos Sketch-n-Sketch DM + Code DDV Apparatus Domain Apps Parametric CAD Procedural modeling
Our Approach
Start with general-purpose language add D.M. features.
40
41
Demos on YouTube
https://ravichugh.github.io/sketch-n-sketch
42
Just google “sketch n sketch”
Demos on YouTube
https://ravichugh.github.io/sketch-n-sketch
42
43
44
45
Traces
46
Traces
let a = 3 in
46
Traces
let a = 3 in let b = 5 in
46
Traces
let a = 3 in let b = 5 in a + b
46
Traces
let a = 3 in let b = 5 in a + b
46
Traces
let a = 3 in let b = 5 in a + b
8
46
Traces
let a = 3a in let b = 5 in a + b
8
47
Traces
let a = 3a in let b = 5b in a + b
8
48
Traces
let a = 3a in let b = 5b in a + b
8a+b
49