Top Banner
February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian Hempel Jacob Albers Grace Lu Justin Lubin Mitch Spradlin [Wikipedia ]
108

Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Aug 30, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

February 20, 2017

Direct Manipulation Programming Systems

Ravi Chugh

Brian Hempel Jacob Albers

Grace Lu Justin Lubin

Mitch Spradlin

[Wikipedia]

Page 2: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

(d)

(a) (b) (c)

(e) (f)Task:  

Q: What Would You Choose?  Programming Language

(e.g. JavaScript, Processing) Direct Manipulation System (e.g. Illustrator, PowerPoint)

2  

Page 3: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

(d)

(a) (b) (c)

(e) (f)Task:  

Q: What Would You Choose?  Programming Language

(e.g. JavaScript, Processing) ✗ Direct Manipulation System (e.g. Illustrator, PowerPoint) ✗

3  

Page 4: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

4  

Page 5: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

5  

Page 6: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

6  

Page 7: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

7  

Page 8: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

8  

Page 9: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

9  

Page 10: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

10  

Page 11: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

11  

✗  

Page 12: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

12  

Page 13: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

13  

Page 14: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

14  

Page 15: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

15  

Page 16: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

16  

Page 17: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

17  

✗  

Page 18: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

18  

Page 19: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Direct Manipulation System…  

19  

Page 20: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Programming System…  

 circle1  =  ...  

20  

"Draw"

Page 21: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Programming System…  

 circle1  =  ...    line1  =  ...    line2  =  ...  

21  

"Draw"

Page 22: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Programming System…  

 circle1  =  ...    line1  =  ...    line2  =  ...  

 circle1  =  ...    pt1  =  left(circle1)  line1  =  ...    line2  =  ...  

22  

"Relate"

Page 23: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Programming System…  

 circle1  =  ...    pt1  =  left(circle1)  line1  =  ...    line2  =  ...  

 circle1  =  ...    pt1  =  left(circle1)  pt2  =  right(circle1)  line1  =  ...    line2  =  ...  

23  

"Relate"

Page 24: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Programming System…  

 circle1  =  ...    pt1  =  left(circle1)  pt2  =  right(circle1)  line1  =  ...    pt3  =  top(circle1)  pt4  =  bottom(circle1)  line2  =  ...  

24  

"Relate"

Page 25: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Programming System…  

 circle1  =  ...    pt1  =  left(circle1)  pt2  =  right(circle1)  line1  =  ...    pt3  =  top(circle1)  pt4  =  bottom(circle1)  line2  =  ...    rectArray  =  ...  

25  

"Relate"

Page 26: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Programming System…  

 circle1  =  ...    pt1  =  left(circle1)  pt2  =  right(circle1)  line1  =  ...    pt3  =  top(circle1)  pt4  =  bottom(circle1)  line2  =  ...    rectArray  =  ...  

 function  ferrisWheel      (  numSpokes      ,  spokeLen      ,  rotAngle      ,  sizeCar      ,  radiusCenter      ,  cx      ,  cy      )  {  ...  }    ferrisWheel(4,  ...);  

26  

"Group"

Page 27: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Programming System…  

 function  ferrisWheel      (  numSpokes      ,  spokeLen      ,  rotAngle      ,  sizeCar      ,  radiusCenter      ,  cx      ,  cy      )  {  ...  }    ferrisWheel(4,  ...);  

27  

"Tweak"

Page 28: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Programming System…  

 function  ferrisWheel      (  numSpokes      ,  spokeLen      ,  rotAngle      ,  sizeCar      ,  radiusCenter      ,  cx      ,  cy      )  {  ...  }    ferrisWheel(8,  ...);  

28  

"Tweak"

Page 29: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

29  29  

Imagine Using a Programming System…  

 function  ferrisWheel      (  numSpokes      ,  spokeLen      ,  rotAngle      ,  sizeCar      ,  radiusCenter      ,  cx      ,  cy      )  {  ...  }    ferrisWheel(8,  ...);  

"Tweak"

Page 30: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Programming System…  

 function  ferrisWheel      (  numSpokes      ,  spokeLen      ,  rotAngle      ,  sizeCar      ,  radiusCenter      ,  cx      ,  cy      )  {  ...  }    ferrisWheel(8,  ...);  

30  

"Tweak"

Page 31: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Programming System…  

 function  ferrisWheel      (  numSpokes      ,  spokeLen      ,  rotAngle      ,  sizeCar      ,  radiusCenter      ,  cx      ,  cy      )  {  ...  }    ferrisWheel(8,  ...);  

31  

"Tweak"

Page 32: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Programming System…  

 function  ferrisWheel      (  numSpokes      ,  spokeLen      ,  rotAngle      ,  sizeCar      ,  radiusCenter      ,  cx      ,  cy      )  {  ...  }    ferrisWheel(16,  ...);  

32  

"Tweak"

Page 33: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Imagine Using a Programming System…  

33  

 function  ferrisWheel      (  numSpokes      ,  spokeLen      ,  rotAngle      ,  sizeCar      ,  radiusCenter      ,  cx      ,  cy      )  {  ...  }    ferrisWheel(16,  ...);  

Page 34: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

34  

���Programming

Language

���Direct

Manipulation

2D Graphics

Presentations

Documents

Spreadsheets

Web Apps

Page 35: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

35  

���Programming

Language

���Direct

Manipulation

2D Graphics

Presentations

Documents

Spreadsheets

Web Apps

General-Purpose���Languages

Domain-Specific���Languages or���

Libraries Domain-Specific���

GUI Tools

Page 36: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

36  

���Programming

Language

���Direct

Manipulation

2D Graphics

Presentations

Documents

Spreadsheets

Web Apps

Direct Manipulation Programming

???

???

???

???

???

Sketch-n-Sketch

Page 37: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

37  

Our Approach

Reuse effort across domains.

Enable experts and library writers to extend built-ins.

Smooth spectrum between "Experts" and "End Users".

λ-calculus + Direct���Manipulation

Page 38: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

38  

Sketch-n-Sketch Demo

Page 39: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

39  

Sketch-n-Sketch Demo

Programming with:���Less Keyboard. ���More Mouse.

Page 40: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

40  

Semi-Automated Programming by���

Manipulating���Output

Page 41: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

41  

Draw

Relate

Group

Tweak PLDI 2016

UIST 2016

Page 42: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

42  

Relate Group Tweak Draw

Page 43: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

43  

Tweak Draw Relate Group

e' ⇓t  'v'  

Page 44: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

44  

Tweak Draw Relate Group

e' ⇓t  'v'  e' ⇓t  'v'   v' = t  Constraint on Original e:  

v' = t  Constraint on Updated e':  

e' ⇓t  'v'  

Page 45: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

45  

Tweak Draw Relate Group

e' ⇓t  'v'   v' = t  Constraint on Original e:  

v' = t  Constraint on Updated e':  

e' ⇓t  'v'  

Page 46: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

46  

Tweak Draw Relate Group

e' ⇓t  'v'  t ::= x���t :|= t1 + t2 ���t :|= t1 * t2 t :|= sin t t :|= pow t1 t2 t :|= ...

Dataflow-Only Traces

Page 47: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

47  

Tweak Draw Relate Group

let a = 1 let b = 2 in …  

⇓a a   1'  

⇓a+b a+b   3'  

⇓a+b*b a+b*b   5'  

⇓a (\x.x) a   1'  

⇓a true ? a : b   1'  

Page 48: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

48  

Tweak Draw Relate Group

155 = x0 + 2 * sep  

Change x0 or sep? Or both? Or more?

Change exactly one constant. Heuristics to automatically choose.

Annotations to freeze (n!) or thaw (n?).

110 = x0 + 2 * sep  ⇝  

Page 49: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

49  

Tweak Draw Relate Group

Can solve for x if x only occurs once.

5*sin(x) = n

x*(y+y2) = n

x2 = n

Page 50: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

50  

Tweak Draw Relate Group

Good enough for 80% of equations.

Can solve for x if x only occurs once.

5*sin(x) = n

x*(y+y2) = n x*(x+y2) = n

x2 = n x*x = n

✗  ✓

✗  ✓

Page 51: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

51  

Draw Relate Group Tweak

(x1,y1)  

(x3,y3)  

(x2,y2)  

"Raw"���Shape

Page 52: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

52  

Draw Relate Group Tweak

(x1,y1)  

(x1+2,y1+8)  (x1+10,y1+10)  

"Anchored"���Shape

Page 53: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

53  

Draw Relate Group Tweak

(x1,y1)  

(x2,y2)  

(x1+0.20*(x2-­‐x1)  ,y1+0.80*(y2-­‐y1))  

"Bounded"���Shape

Page 54: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

54  

Draw Relate Group Tweak

(def  rawPoly      (let  [x1  y1]  ...      (let  [x2  y2]  ...      (let  [x3  y3]  ...          ...  ))))  

(def  anchoredPoly      (let  [x1  y1]  ...      (let  [dx2  dy2]  ...      (let  [dx3  dy3]  ...          ...  ))))  

(def  boundedPoly      (let  [x1  y1]  ...      (let  [x2  y2]  ...      (let  [px3  py3]  ...      ...  ))))  

⇓   ⇓   ⇓  

Representation affects grouping operations.

Page 55: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

55  

Group Draw Relate Tweak

"Anchored"���Group

"Bounded"���Group

Page 56: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

56  

Group Draw Relate

"Anchored"���Group

"Bounded"���Group

Tweak

Page 57: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

57  

Group Draw Relate

"Anchored"���Group

"Bounded"���Group

Tweak

Page 58: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

58  

Group Draw Relate

"Anchored"���Group

"Bounded"���Group

Tweak

Page 59: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

59  

Relate Draw Group Tweak

       (def  rect1      (let  x  52  ...  ))    (def  line2      (let  x1  50  ...  ))    (def  line3      ...  )  

Page 60: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

60  

Relate Draw Group Tweak

       (def  rect1      (let  x  52  ...  ))    (def  line2      (let  x1  50  ...  ))    (def  line3      ...  )  

SELECT DIG FILL

CLEAN

Features in Canvas New Hole in Code Hole with Relationship New Code

Page 61: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

61  

Relate Draw Group Tweak

       (def  rect1      (let  x  52  ...  ))    (def  line2      (let  x1  50  ...  ))    (def  line3      ...  )  

UNSELECTED Features  

Page 62: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

62  

Relate Draw Group Tweak

       (def  rect1      (let  x  52  ...  ))    (def  line2      (let  x1  50  ...  ))    (def  line3      ...  )  

UNSELECTED Features  SELECTED Features  

Page 63: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

63  

Relate Draw Group Tweak

(def  rect1_x  52)  (def  line2_x1  50)  (def  [rect1_x'  line2_x1']  [rect1_x  line2_x1])    (def  rect1      (let  x  rect1_x'  ...  ))    (def  line2      (let  x1  line2_x1'  ...  ))    (def  line3      ...  )  

LIFT Constants and���DIG New Hole  FILL Hole w/��� Desired Relationship  

Page 64: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

64  

Relate Draw Group Tweak

(def  rect1_x  52)  (def  line2_x1  50)  (def  [rect1_x'  line2_x1']  [rect1_x  rect1_x])    (def  rect1      (let  x  rect1_x'  ...  ))    (def  line2      (let  x1  line2_x1'  ...  ))    (def  line3      ...  )  

CLEAN Dead Vars  

Page 65: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

65  

Relate Draw Group Tweak

(def  rect1_x  52)    (def  [rect1_x'  line2_x1']  [rect1_x  rect1_x])    (def  rect1      (let  x  rect1_x'  ...  ))    (def  line2      (let  x1  line2_x1'  ...  ))    (def  line3      ...  )  

CLEAN Redundant Vars  

Page 66: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

66  

Relate Draw Group Tweak

(def  rect1_x  52)        (def  rect1      (let  x  rect1_x  ...  ))    (def  line2      (let  x1  rect1_x  ...  ))    (def  line3      ...  )  

Page 67: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

67  

Relate Draw Group Tweak

(def  rect1_x  52)    (def  rect1      (let  x  rect1_x  ...  ))    (def  line2      (let  x1  rect1_x  ...  ))    (def  line3      ...  )  

Automatic solver���for Make Equal.

Page 68: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

68  

Group Draw Relate Tweak

Which Constants to Abstract?

Heuristic: Unfrozen and Named

(def  foo      (let  [a  b]  [1  2!]          [a  b  3]))    

foo  

Page 69: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

69  

Group Draw Relate Tweak

Which Constants to Abstract?

Heuristic: Unfrozen and Named

(def  foo      (let  [a  b]  [1  2!]          [a  b  3]))    

foo  

(def  foo  (\a      (let  [b]  [2!]          [a  b  3])))    

(foo  1)  

Page 70: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

70  

Draw Relate Group Tweak

Sketch-n-Sketch Programming in 2015

Less Keyboard. ���More Mouse.

Page 71: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

71  

Draw Relate Group Tweak

Sketch-n-Sketch

Page 72: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

72  

Relate Draw Group Tweak

Sketch-n-Sketch

e3

e1

e2

Page 73: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

73  

Relate Draw Tweak

Sketch-n-Sketch

e3

e1

e2

Group

Less Reliance���

on Syntactic Structure

Sketch-n-Sketch ++

Page 74: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

;  Top-­‐Level  Defs  (def  rect1  ...)  (def  line2  ...)  (def  line3  ...)    ;  Main  Expression  [  rect1  ...  ]  

74  

Draw Relate Group Tweak

Sketch-n-Sketch Sketch-n-Sketch ++

Page 75: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

;  Top-­‐Level  Defs  def  rect1  =  ...  def  line2  =  ...  def  line3  =  ...    ;  Main  Expression  (blobs  [  rect1  ...  ])  

(def  group1      (def  rect1  ...)      (def  line2  ...)      (def  line3  ...)          [  rect1  ...  ]  )    group1  

75  

Draw Relate Group Tweak

Sketch-n-Sketch

Less Reliance���

on Syntactic Structure

Sketch-n-Sketch ++

Page 76: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

(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...  

76  

Draw Relate Group Tweak

Sketch-n-Sketch Sketch-n-Sketch ++

Smarter���Algebraic���Constraint���

Solver

Page 77: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

77  

Draw Relate Group Tweak

Sketch-n-Sketch Sketch-n-Sketch ++

Page 78: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

78  

Draw Relate Group Tweak

Sketch-n-Sketch Sketch-n-Sketch ++

Smarter���Algebraic���Constraint���

Solver

Page 79: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

79  

Draw Relate Group Tweak

Sketch-n-Sketch Sketch-n-Sketch ++

Additional���Interaction���to Resolve���User Intent

Page 80: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

80  

Draw Relate Group Tweak

Sketch-n-Sketch Sketch-n-Sketch ++

Expressive,���General Program Synthesis

Limited, Syntactic Program Updates

Page 81: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

81  

Draw Relate Group Tweak

Page 82: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

82  

Draw Relate Group Tweak

Prototype; Repair; Refactor; Repeat  

Idea

Page 83: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

DM

2D Graphics

Presentations

Documents

Spreadsheets

Web Apps

???

???

???

???

PL

83  

Prototype; Repair; Refactor; Repeat  

Idea

General���Purpose PL

+

General���Program���Synthesis

Domain Specific UI

+

Domain Specific���Program���Synthesis

+

Sketch-n-Sketch

Page 84: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

DM

2D Graphics

Presentations

Documents

Spreadsheets

Web Apps

???

???

???

???

PL

Domain Specific UI

+

Domain Specific���Program���Synthesis

84  

Prototype; Repair; Refactor; Repeat  

Idea

General���Purpose PL

+

General���Program���Synthesis

+

λ Sketch-n-Sketch

Page 85: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

85  

λ-Calculus + Direct Manipulation of Output

1 : Mouse-Edit Output

Page 86: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

86  

λ-Calculus + Direct Manipulation of Code

1 : Mouse-Edit Output

2 : Mouse-Edit Code

Page 87: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Programming with���Less Keyboard.

Programming with���More Mouse.

87  

Page 88: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

88  

Related Work

DM + Code

Dynamic Drawing���Apparatus

Code + DM

Wang et al. [FSE 2012]���McDirmid's Demos���

Sketch-n-Sketch

Constraints

Sketchpad���ThingLab ���

Juno-2

Program Synthesis���(Sketching, PBE)

Program Repair

Text + Structure Editors

Barista���

Drag-n-Drop Refactor Sketch-n-Sketch++

Page 89: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

89  

http://ravichugh.github.io/sketch-­‐n-­‐sketch/  

VIDEOS  

PAPERS  

DEMO  

CODE  

PLDI 2016  

UIST 2016  

~20,000 LOC Elm

Page 90: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

90  

λ-Calculus + Direct Manipulation of Code and Output

0 : Text-Edit Code

1 : Mouse-Edit Output

2 : Mouse-Edit Code

Page 91: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

91  

EXTRA SLIDES

Page 92: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

92  

Draw

Relate

Group

Tweak

Sketch-n-Sketch

Page 93: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

DM

2D Graphics

Presentations

Documents

Spreadsheets

Web Apps

???

???

???

???

PL

93  

Prototype; Repair; Refactor; Repeat  

Idea

General���Purpose PL

+

General���Program���Synthesis

Domain Specific UI

+

Domain Specific���Program���Synthesis

+

Sketch-n-Sketch

Page 94: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

Programs ???

DM

2D Graphics

Presentations

Documents

Spreadsheets

Web Apps

???

???

???

???

PL

94  

Prototype; Repair; Refactor; Repeat  

Idea

General���Purpose PL

+

General���Program���Synthesis

Domain Specific UI

+

Domain Specific���Program���Synthesis

+

Sketch-n-Sketch

DM Text Interactive General Purpose IDE

Page 95: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

95  

Reuse effort across domains.

Enable experts and library writers���to extend built-ins.

Smooth spectrum between���"Experts" and "End Users".

λ-Calculus + Direct Manipulation

Page 96: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

96  

Text editing is great, but…

Many mundane, low-level edits.

Especially with generated code.

λ-Calculus + Direct Manipulation of Code

Page 97: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

97  

Idea: Selectable AST Nodes

(def  foo  (\a      (let  [b]  [2!]          [a  b  3])))    

(foo  1)  

(def  foo      (let  [a  b]  [1  2!]          [a  b  3]))    

foo  

Page 98: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

98  

Idea: Selectable AST Nodes

(def  foo  (\a  c      (let  [b]  [2!]          [a  b  c])))    

(foo  1  3)  

(def  foo      (let  [a  b]  [1  2!]          [a  b  3]))    

foo  

Page 99: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

99  

Idea: Selectable AST Nodes

   (def  rect1      (let  x  52  ...  ))    (def  line2      (let  x1  50  ...  ))    (def  line3      ...  )  

Page 100: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

100  

Idea: Selectable AST Nodes

   (def  rect1      (let  x  52  ...  ))    (def  line2      (let  x1  50  ...  ))    (def  line3      ...  )  

Page 101: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

101  

Idea: Selectable AST Nodes

   (def  rect1      (let  x  52  ...  ))    (def  line2      (let  x1  50  ...  ))    (def  line3      ...  )  

(def  rect1_x  52)    (def  rect1      (let  x  rect1_x  ...  ))    (def  line2      (let  x1  rect1_x  ...  ))    (def  line3      ...  )  

Page 102: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

102  

Idea: Draggable AST Nodes

(def  rect1_x  52)  

(def  line3      ...  )  

(def  line2      (let  x1  rect1_x  ...  ))  

(def  rect1      (let  x  rect1_x  ...  ))  

Page 103: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

103  

Idea: Draggable AST Nodes

(def  rect1_x  52)  

(def  line3      ...  )  

(def  line2      (let  x1  rect1_x  ...  ))  

(def  rect1      (let  x  rect1_x  ...  ))  

Page 104: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

104  

Idea: Draggable AST Nodes

(def  rect1_x  52)  

(def  line3      (let  x1  200  ...  )  

(def  line2      (let  x1  rect1_x  ...  ))  

(def  rect1      (let  x  rect1_x  ...  ))  

Page 105: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

105  

Idea: Draggable AST Nodes

(def  line3_x1  200)  

(def  line3      (let  x1  line3_x1  ...  )  

(def  line2      (let  x1  rect1_x  ...  ))  

(def  rect1      (let  x  rect1_x  ...  ))  

(def  rect1_x  52)  Copy-Paste,���Scope Manipulation,���Name Generation, Substitution,���Formatting, …

Page 106: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

106  

(def  [x1  y1]  [0  0])  (def  [x2  y2]  [(+  x1  10)  (+  y1  10)])  (def  [x3  y3]  [(+  x1    2)  (+  y1    8)])  

Idea: Auto Reformatting

Page 107: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

107  

Idea: Auto Reformatting

(def  [x1  y1]  [0  0])  (def  x2  (+  x1  10)  (def  y2  (+  y1  10)  (def  x3  (+  x1    2)  (def  y3  (+  y1    8)  

Whitespace,���Line Breaks,���Single vs. Multi Defs,���Alignment,���Style Conventions, …

Page 108: Direct Manipulation Programming Systemspeople.cs.uchicago.edu/~rchugh/static/talks/feb-2017-sns.pptx.pdf · February 20, 2017 Direct Manipulation Programming Systems Ravi Chugh Brian

108  

END