Spoken Language Support for Software Development

100
1 Spoken Language Support for Software Development Andrew Begel Advisor: Susan L. Graham Computer Science Division, EECS University of California, Berkeley

description

Spoken Language Support for Software Development. Andrew Begel Advisor: Susan L. Graham Computer Science Division, EECS University of California, Berkeley. Human-Computer Interaction. Programming Languages. Human-Centric Software Tools. Software Engineering. - PowerPoint PPT Presentation

Transcript of Spoken Language Support for Software Development

Page 1: Spoken Language Support for Software Development

1

Spoken Language Support for Software

Development

Andrew BegelAdvisor: Susan L. GrahamComputer Science Division, EECSUniversity of California, Berkeley

Page 2: Spoken Language Support for Software Development

2

Interactive Software Development

Human-ComputerInteraction

ProgrammingLanguages

Software Engineering

Human-CentricSoftware Tools

Page 3: Spoken Language Support for Software Development

3

Motivation

• Programmers conventionally use keyboard– Long hours at keyboard leads to higher risk of RSI

• Can speech-based programming be an alternative?• Combines an unambiguous domain

(programming) with an inherently ambiguous input modality (speech)– Great for exploring ambiguity handling in a new

context

while (counter < limit) { }

Page 4: Spoken Language Support for Software Development

4

Programming by Voice

• My Goal– Find out how developers use code verbally. Use this to

develop a naturally verbalizable input form.– Build development environment that supports verbal

authoring, navigation, modification.• Extend conventional compiler analyses to support ambiguities

generated by speech.– Learn how developers can use voice-based programming,

and iterate design.

while counter is lessthan limit do ...

Page 5: Spoken Language Support for Software Development

5

Challenges

Programming languages were not designed to be spoken.

Speech is inherently ambiguous. Programming tools were not designed for ambiguity.

Speech tools are poorly suited for programming tasks.

Programmers are not used to verbal software development.

Page 6: Spoken Language Support for Software Development

6

Talk Outline

• Introduction and Motivation Programming by Voice• Program Analyses for Ambiguous Inputs• Program Navigation and Editing• Conclusion

Page 7: Spoken Language Support for Software Development

7

Programming by Voice

for (int i = 0; i < 10; i++ ) { ▌}

Page 8: Spoken Language Support for Software Development

8

Current Tools are Awkward!

for (▌ ; ; ) { }

VoiceCode[Desilets 2004]

1234

for loop … after left paren … declare india of type integer … assign zero … after semi … recall one … less than ten … after semi … recall one … increment … after left brace

Page 9: Spoken Language Support for Software Development

9

for (int i = 0;▌ ; ) { }

1234

i

Current Tools are Awkward!

1234

i

VoiceCode[Desilets 2004]

for loop … after left paren … declare india of type integer … assign zero … after semi … recall one … less than ten … after semi … recall one … increment … after left brace

Page 10: Spoken Language Support for Software Development

10

for (int i = 0; i < 10;▌ ) { }

Current Tools are Awkward!

1234

i1234

i

VoiceCode[Desilets 2004]

for loop … after left paren … declare india of type integer … assign zero … after semi … recall one … less than ten … after semi … recall one … increment … after left brace

Page 11: Spoken Language Support for Software Development

11

for (int i = 0; i < 10; i++ ) { ▌}

1234

i

Current Tools are Awkward!

1234

i1234

i

VoiceCode[Desilets 2004]

for loop … after left paren … declare india of type integer … assign zero … after semi … recall one … less than ten … after semi … recall one … increment … after left brace

Page 12: Spoken Language Support for Software Development

12

Programming by Voice Related Work

Human-CentricComputer-Centric

MultipleTasks

AuthoringOnly

Arnold ‘00

Snell ‘00

Price ‘00 ‘02

Desilets ‘01 ‘04

Gray ‘03

Begel ‘05

Page 13: Spoken Language Support for Software Development

13

How do Programmers Speak Code?

• 10 programmers read Java code out loud (Begel ‘05)

• Most programmers spoke the same way

Page 14: Spoken Language Support for Software Development

14

for int i equals zero i less than ten i plus plus

for (int i = 0; i < 10; i++ ) { ▌}

How do Programmers Speak Code?

Page 15: Spoken Language Support for Software Development

15

Awkwardness by Design (Structural)

(int)foo

(3 + 5) * 7

How do Programmers Speak Code?

Page 16: Spoken Language Support for Software Development

16

How do Programmers Speak Code?

Individual Inconsistency

System.out.println vs. System out println

bar sub i vs. bar of i vs. i from bar

Page 17: Spoken Language Support for Software Development

17

How do Programmers Speak Code?

Native English speakers vs. non-native speakers (Pronunciation)

tur vs. t u r

println

array[i++] vs. array[i]++

Page 18: Spoken Language Support for Software Development

18

A Natural Way to Code

for int i equals zero i less than ten i plus plus

for (int i = 0; i < 10; i++ ) { ▌}

Page 19: Spoken Language Support for Software Development

19

Too Many Ambiguities

for (int i = 0; i < 10; i++ ) { ▌}

4 int eye equals 0 aye less then ten i plus plus

KW or #?Spelling of ID?

KW or ID?for int i equals zero i less than ten i plus plus

Page 20: Spoken Language Support for Software Development

20

Sometimes It’s Non-Obvious

for (times = 8; file(2, load); times == one) {▌

}

for times equals 8 file 2 load times equals one

fore *= 8; file.tooLode.times = won ▌

4; times = ate(file).to(load).equals(1) ▌

Page 21: Spoken Language Support for Software Development

21

Design Tradeoffs

CommandLanguage

Easy to analyze,but prescriptive

NaturalLanguage

Flexible,but ambiguous

Programmingby Voice

Page 22: Spoken Language Support for Software Development

22

Spoken Java• Semantically identical to Java• Syntactically easier to say than Java

– Methodology generalizable to any computer language

1. All punctuation has English equivalents• Open Brace, End For Loop

2. Most punctuation is optional3. Provide verbalization for all abbreviations4. Relaxed phrasing for better fit with English

• (int)foo “cast foo to integer”• foo = 6 “set foo to 6”• foo[i]++ “increment the ith element of array foo”

Page 23: Spoken Language Support for Software Development

23

SPEED: Speech Editor• Build an editor that supports naturally verbalized

programs• SPEED: SPEech EDitor

• Based on IBM ViaVoice, Eclipse IDE, Harmonia

– Spoken Java Language for Composition– Spoken Command language for Navigation,

Editing, Template instantiation, Refactorings, Search

– Audible and visual feedback• Similar to JavaSpeak (Smith 2000)

Page 24: Spoken Language Support for Software Development

24

Harmonia Analysis Framework

• Framework to support interactive editors– Language-based, programmer-oriented tools

• Incremental analyses– Lexing (Wagner ‘97), GLR Parsing (Wagner ‘97, Begel ‘04), Static

Semantics (Garrison ‘87, Begel, Jamison)

• C, Java, Titanium, Cool, Flex, Bison– Also, languages where indentation and CRs are

significant• Interactive Program Transformations (Java)• CodeLink (Toomim et. al. ‘04)

• Shorthand Editing

Page 25: Spoken Language Support for Software Development

25

Talk Outline

• Introduction and Motivation• Programming by Voice Program Analyses for Ambiguous Inputs • Program Navigation and Editing• Conclusion

Page 26: Spoken Language Support for Software Development

26

Traditional Compiler Analyses

LexicalAnalysis

FOR I

Parsing SemanticAnalysis

for (i = 0; i < 10; i++ ) { }

Programming languages are designed to be unambiguous

For Loop

FOR Assign Expr

I = 0

i LocalVar int

Page 27: Spoken Language Support for Software Development

27

Ambiguity-Aware Analysesfor i equals zero ...

Handles input stream, syntactic and semantic ambiguities

LexicalAnalysis

FOR I

AmbiguousParsing

SemanticAmbiguityResolution

For Loop

FOR Assign Expr

I = 0

i LocalVar int

foureye

LocalVar ?4 EYE FOUREYE

Assign Expr

= 0

Ambig Stmt

Page 28: Spoken Language Support for Software Development

28

Scan Input Stream

CommercialSpeech

Recognizer

HomophoneDictionary Lexical

Analysis

Page 29: Spoken Language Support for Software Development

29

Homophones Cause Ambiguities

for i equals

for i =

4 i equals

foreeye ==

fore ayeequals foureyeequals

foriequals

Concatenated words cause them too

4

forefour

eyeaye

===

Page 30: Spoken Language Support for Software Development

30

Ambiguity-Aware Analysesfor i equals zero ...

LexicalAnalysis

FOR I

XGLRAmbiguous

Parsing

SemanticAmbiguityResolution

For Loop

FOR Assign Expr

I = 0

i LocalVar int

foureye

LocalVar ?4 EYE FOUREYE

Assign Expr

= 0

Ambig Stmt

Page 31: Spoken Language Support for Software Development

31

FOOID

GLR Parsing [ Tomita 85 ]

ELSEKW

IFKW

ExprIF

KW

ExprBAR

ID

Page 32: Spoken Language Support for Software Development

32

FOOID

GLR Parsing [ Tomita 85 ]

ELSEKW

IFKW

ExprIF

KW

ExprBAR

ID

Page 33: Spoken Language Support for Software Development

33

FOOID

GLR Parsing [ Tomita 85 ]

ELSEKW

IFKW

ExprIF

KW

ExprBAR

ID

Page 34: Spoken Language Support for Software Development

34

FOOID

GLR Parsing [ Tomita 85 ]

ELSEKW

IFKW

ExprIF

KW

ExprBAR

ID

Page 35: Spoken Language Support for Software Development

35

FOOID

GLR Parsing [ Tomita 85 ]

ELSEKW

IFKW

ExprIF

KW

ExprBAR

ID

Page 36: Spoken Language Support for Software Development

36

FOOID

GLR Parsing [ Tomita 85 ]

ELSEKW

IFKW

ExprIF

KW

ExprBAR

ID

Page 37: Spoken Language Support for Software Development

37

FOOID

GLR Parsing [ Tomita 85 ]

ELSEKW

IFKW

ExprIF

KW

ExprBAR

ID

FOOID

IFKW

ExprIF

KW

Expr

Page 38: Spoken Language Support for Software Development

38

FOOID

GLR Parsing [ Tomita 85 ]

ELSEKW

IFKW

ExprIF

KW

ExprBAR

ID

FOOID

IFKW

ExprIF

KW

Expr

Stmt

Page 39: Spoken Language Support for Software Development

39

GLR Parsing [ Tomita 85 ]

ELSEKW

BARID

ELSEKW

FOOID

IFKW

ExprIF

KW

Expr

FOOID

IFKW

ExprIF

KW

Expr

Stmt

Page 40: Spoken Language Support for Software Development

40

GLR Parsing [ Tomita 85 ]

ELSEKW

BARID

ELSEKW

BARID

FOOID

IFKW

ExprIF

KW

Expr

FOOID

IFKW

ExprIF

KW

Expr

Stmt

Page 41: Spoken Language Support for Software Development

41

FOOID

GLR Parsing [ Tomita 85 ]

ELSEKW

IFKW

ExprIF

KW

ExprBAR

ID

Stmt

ELSEKW

BARID

FOOID

IFKW

ExprIF

KW

Expr

Stmt

Page 42: Spoken Language Support for Software Development

42

FOOID

GLR Parsing [ Tomita 85 ]

ELSEKW

IFKW

ExprIF

KW

ExprBAR

ID

Stmt

ELSEKW

BARID

FOOID

IFKW

ExprIF

KW

Expr

Stmt

Stmt

Page 43: Spoken Language Support for Software Development

43

FOOID

GLR Parsing [ Tomita 85 ]

ELSEKW

IFKW

ExprIF

KW

ExprBAR

ID

Stmt

ELSEKW

BARID

FOOID

IFKW

ExprIF

KW

Expr

Stmt

Stmt

Stmt

Page 44: Spoken Language Support for Software Development

44

GLR Ambiguity Support

1. Fork when there is more than one possible interpretation (tree)

Page 45: Spoken Language Support for Software Development

45

XGLR Ambiguity Support

1. Fork when there is more than one possible interpretation (tree)

2. Fork when the lexical input is ambiguous

Page 46: Spoken Language Support for Software Development

46

XGLR Parsing [Begel 04]

< XIF FIFTY FIVE

Page 47: Spoken Language Support for Software Development

47

XGLR Parsing [ Begel 04 ]

< XIF FIFTY FIVEKW

Page 48: Spoken Language Support for Software Development

48

XGLR Parsing [ Begel 04 ]

< XFIFTY FIVEIFKW

Page 49: Spoken Language Support for Software Development

49

XGLR Parsing [ Begel 04 ]

< XFIFTY FIVEIFKW

FIFTY 5

50 FIVE

50 5

55

ID

ID

#

#

#

#

ID

#

ID

< X

< X

< X

< X

Page 50: Spoken Language Support for Software Development

50

XGLR Parsing [ Begel 04 ]

FIFTY FIVEIFKW

FIFTY 5

50 FIVE

5

ID

ID

#

50#

55#

#

ID

#

ID

IFKW

IFKW

IFKW

IFKW

< X

< X

< X

< X

< XOp

Page 51: Spoken Language Support for Software Development

51

XGLR Parsing [ Begel 04 ]

FIFTY FIVEIFKW

FIFTY 5

50 FIVE

50 5

55

ID

ID

#

#

#

#

ID

#

ID

IFKW

IFKW

IFKW

IFKW

FIFTYIFKW

FIFTY

ID

IDIF

KW (

(

FIFTYIFKW

FIFTY

ID

IDIF

KW ..

< X

< X

< X

< X

X<Op

Page 52: Spoken Language Support for Software Development

52

XGLR Parsing [ Begel 04 ]

FIFTY FIVEIFKW

FIFTY 5

50 FIVE

50 5

55

ID

ID

#

#

#

#

ID

#

ID

IFKW

IFKW

IFKW

IFKW

FIFTYIFKW

FIFTY

ID

IDIF

KW (

(

FIFTYIFKW

FIFTY

ID

IDIF

KW ..

< X

< X

< X

< X

X<Op

FIVE

5

FIVE

5#

ID

#

ID< X

< X

< X

< X

Page 53: Spoken Language Support for Software Development

53

XGLR Parsing [ Begel 04 ]

FIFTY FIVEIFKW

FIFTY 5

50 FIVE

50 5

55

ID

ID

#

#

#

#

ID

#

ID

IFKW

IFKW

IFKW

IFKW

FIFTYIFKW

FIFTY

ID

IDIF

KW (

(

FIFTYIFKW

FIFTY

ID

IDIF

KW ..

< X

< X

< X

< X

X<Op

FIVE

5

FIVE

5#

ID

#

ID< X

< X

< X

< X

Page 54: Spoken Language Support for Software Development

54

XGLR Parsing [ Begel 04 ]

FIFTY FIVEIFKW

FIFTY 5

50 FIVE

50 5

55

ID

ID

#

#

#

#

ID

#

ID

IFKW

IFKW

IFKW

IFKW

FIFTYIFKW

FIFTY

ID

IDIF

KW (

(

FIFTYIFKW

FIFTY

ID

IDIF

KW ..

< X

< X

< X

< X

X<Op

FIVE

5

FIVE

5#

ID

#

ID< X

< X

< X

< X

Page 55: Spoken Language Support for Software Development

55

XGLR Parsing [ Begel 04 ]

55#

IFKW

FIFTYIFKW

FIFTY

ID

IDIF

KW (

(

FIFTYIFKW ID .

X<Op

FIVE

5

FIVEID

#

ID< X

< X

< X

Page 56: Spoken Language Support for Software Development

56

XGLR Parsing [ Begel 04 ]

55#

IFKW

FIFTYIFKW

FIFTY

ID

IDIF

KW (

(

FIFTYIFKW ID .

X<Op

FIVE

5

FIVEID

#

ID< X

< X

< X

FIFTYIFKW ID ( FIVE

ID

FIFTYIFKW ID ( FIVE

ID

FIFTYIFKW ID . FIVE

ID

FIFTYIFKW ID . FIVE

ID .

.(

(

< X

< X

< X

< X

FIFTYIFKW

FIFTY

ID

IDIF

KW (

( FIVE

5#

ID )

)

< X

< X

Page 57: Spoken Language Support for Software Development

57

XGLR Parsing [ Begel 04 ]

55#

IFKW

FIFTYIFKW

FIFTY

ID

IDIF

KW (

(

FIFTYIFKW ID .

X<Op

FIVE

5

FIVEID

#

ID< X

< X

< X

FIFTYIFKW ID ( FIVE

ID

FIFTYIFKW ID ( FIVE

ID

FIFTYIFKW ID . FIVE

ID

FIFTYIFKW ID . FIVE

ID .

.(

(

< X

< X

< X

< X

FIFTYIFKW

FIFTY

ID

IDIF

KW (

( FIVE

5#

ID )

)

< X

< X

Op

Op

Op

Op

Op

Op

Op

Op

Op

ID

Page 58: Spoken Language Support for Software Development

58

XGLR Parsing [ Begel 04 ]

55#

IFKW

FIFTYIFKW

FIFTY

ID

IDIF

KW (

(

FIFTYIFKW ID .

X<Op

FIVE

5

FIVEID

#

ID< X

< X

< X

FIFTYIFKW ID ( FIVE

ID

FIFTYIFKW ID ( FIVE

ID

FIFTYIFKW ID . FIVE

ID

FIFTYIFKW ID . FIVE

ID .

.(

(

< X

< X

< X

< X

FIFTYIFKW

FIFTY

ID

IDIF

KW (

( FIVE

5#

ID )

)

< X

< X

Op

Op

Op

Op

Op

Op

Op

Op

Op

ID

Page 59: Spoken Language Support for Software Development

59

XGLR Parsing [ Begel 04 ]

55#

IFKW

FIFTYIFKW

FIFTY

ID

IDIF

KW (

(

FIFTYIFKW ID .

X<Op

FIVE

5

FIVEID

#

ID< X

< X

< X

FIFTYIFKW

FIFTY

ID

IDIF

KW (

( FIVE

5#

ID )

)

< X

< X

Op

Op

Op

Op

Op

ID

Page 60: Spoken Language Support for Software Development

60

XGLR Parsing [ Begel 04 ]

55#

IFKW

FIFTYIFKW

FIFTY

ID

IDIF

KW (

(

FIFTYIFKW ID .

X<Op

FIVE

5

FIVEID

#

ID< X

< X

< X

FIFTYIFKW

FIFTY

ID

IDIF

KW (

( FIVE

5#

ID )

)

< X

< X

Op

Op

Op

Op

Op

ID

ID

ID

ID

ID

ID

Page 61: Spoken Language Support for Software Development

61

XGLR Parsing [ Begel 04 ]

55#

IFKW

FIFTYIFKW

FIFTY

ID

IDIF

KW (

(

FIFTYIFKW ID .

X<Op

FIVE

5

FIVEID

#

ID< X

< X

< X

FIFTYIFKW

FIFTY

ID

IDIF

KW (

( FIVE

5#

ID )

)

< X

< X

Op

Op

Op

Op

Op

ID

ID

ID

ID

ID

ID

Page 62: Spoken Language Support for Software Development

62

XGLR Parsing [ Begel 04 ]

55#

IFKW

FIFTYIFKW ID .

X<Op

FIVEID

< X

FIFTYIFKW

FIFTY

ID

IDIF

KW (

( FIVE

5#

ID )

)

< X

< X

Op

Op

Op

ID

ID

ID

ID

FIFTYIFKW

FIFTY

ID

IDIF

KW (

( FIVE

5#

ID< X

< X

Op

Op

ID

ID

Page 63: Spoken Language Support for Software Development

63

XGLR Parsing [ Begel 04 ]

55#

IFKW

FIFTYIFKW

FIFTY

ID

IDIF

KW (

(

FIFTYIFKW ID .

X<Op

FIVE

5

FIVEID

#

ID< X

< X

< X

FIFTYIFKW

FIFTY

ID

IDIF

KW (

( FIVE

5#

ID )

)

< X

< X

Op

Op

Op

Op

Op

ID

ID

ID

ID

ID

ID

Expr

ExprExpr

ExprFuncCall

ExprFuncCall

Page 64: Spoken Language Support for Software Development

64

XGLR Summary

• Generalization of traditional GLR algorithm– Forks on structural and lexical ambiguity– Preserves subtree sharing when parses have

different yields– Preserves efficiency when parses get out of sync

• Determine parse position w.r.t. ambiguous input

• Blender: Combined lexer and parser generator for XGLR

Page 65: Spoken Language Support for Software Development

65

GLR Parsing Genealogy

Tomita1985

Farshi1991

Rekers1992

Wagner1997

Visser1997

van den Brand2002

Begel2004

Incremental

Scannerless

Johnstone et. al.2002

Input StreamAmbiguities

Page 66: Spoken Language Support for Software Development

66

Ambiguity-Aware Analysesfor i equals zero ...

LexicalAnalysis

FOR I

XGLRAmbiguous

Parsing

SemanticAmbiguityResolution

For Loop

FOR Assign Expr

I = 0

i LocalVar int

foureye

LocalVar ?4 EYE FOUREYE

Assign Expr

= 0

Ambig Stmt

Page 67: Spoken Language Support for Software Development

67

Disambiguation Exampleclass Loader {

public void load() { String filetoload = null;InputStream stream =

getStream();... ▌

}}

file to load equals stream dot read string

filetoload = stream.readString();

Page 68: Spoken Language Support for Software Development

68

Many Interpretations

file(2, load)

file(to, load) file(to.lode) file(to(lode)) file(toload)

(file, 2, load)

file.to.load file.to(load)

file.toload filetoload() filetoload

Page 69: Spoken Language Support for Software Development

69

Incremental Semantics• What does this name mean? • What names are visible at this program

point?– Or, What can I say here?

• Visibility Graph [Garrison 1987]– Incrementally updated data structure for scopes, names

and bindings– Designed Visibility Graph algorithms for name

propagation and incremental update– Used for type checking, too

• Doesn’t <insert favorite IDE here> do this?

Page 70: Spoken Language Support for Software Development

70

Program Context Can Helpclass Loader {

public void load() {String filetoload = null;InputStream stream =

getStream();... ▌

}}

class Loaderscope

[ load, Method, () void ]

method loadscope

[ filetoload, LocalVar, String ][ stream, LocalVar, InputStream ]

Page 71: Spoken Language Support for Software Development

71

Program Context Can Helpclass Loader {

public void load() {String filetoload = null;InputStream stream =

getStream();... ▌

}}

class Loaderscope

[ load, Method, () void ]

method loadscope

[ filetoload, LocalVar, String ][ stream, LocalVar, InputStream ][ load, Method, () void ]

Page 72: Spoken Language Support for Software Development

72

Semantic Disambiguation

file(2, load)

file(to, load) file(to.lode) file(to(lode)) file(toload)

(file, 2, load)

file.to.load

file.to(load)

file.toload filetoload() filetoload

class Loaderscope

[ load, Method, () void ]

method loadscope

[ filetoload, LocalVar, String ][ stream, LocalVar, InputStream ][ load, Method, () void ]

Page 73: Spoken Language Support for Software Development

73

Semantic Disambiguation

file(2, load)

file(to, load) file(to.lode) file(to(lode)) file(toload)

(file, 2, load)

file.to.load

file.to(load)

file.toload filetoload() filetoload

class Loaderscope

[ load, Method, () void ]

method loadscope

Is “file” a visible variable name?

[ filetoload, LocalVar, String ][ stream, LocalVar, InputStream ][ load, Method, () void ]

Page 74: Spoken Language Support for Software Development

74

Semantic Disambiguation

file(2, load)

file(to, load) file(to.lode) file(to(lode)) file(toload)

filetoload() filetoload

class Loaderscope

[ load, Method, () void ]

method loadscope

Is “file” a visible method name?

[ filetoload, LocalVar, String ][ stream, LocalVar, InputStream ][ load, Method, () void ]

Page 75: Spoken Language Support for Software Development

75

Semantic Disambiguation

filetoload() filetoload

class Loaderscope

[ load, Method, () void ]

method loadscope

Is “filetoload” a visible method name?

[ filetoload, LocalVar, String ][ stream, LocalVar, InputStream ][ load, Method, () void ]

Page 76: Spoken Language Support for Software Development

76

Manual Disambiguation• Some ambiguities cannot (and should not) be

automatically resolved:

print(“line”) vs. println()

if (pred1) then if (pred2) then foo() else bar()

• If ambiguities remain, ask the user how to resolve them. (e.g. [Mankoff 00])

if

foo()

if

bar()

if

if

foo()

bar()

Page 77: Spoken Language Support for Software Development

77

Talk Outline

• Introduction and Motivation• Programming by Voice• Program Analyses for Ambiguous Inputs Program Navigation and Editing• Conclusion

Page 78: Spoken Language Support for Software Development

78

Study - Navigation by Speech1. Eight navigation tasks with commercial VR tools2. Search through text (w/o Find dialog), e.g.

Find the sentence where Romeo cries out about his fate after killing

Tybalt.Metrics

1. Time to scroll to right page2. Number of commands3. Number of recognition

errors4. Number of system mistakes

Results1. Cognitive load is too high -

too many commands, misestimation errors

2. Voice recognition induces too much delay/errors for accurate control

Page 79: Spoken Language Support for Software Development

79

SPEED Navigation

• Shorthand Editingclass Loader {

public void load() { InputStream stream = getStream(); String filetoload = null; filetoload = “file.txt”;

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

Page 80: Spoken Language Support for Software Development

80

SPEED Navigation

• Shorthand Editingclass Loader {

public void load() { InputStream stream = getStream(); String filetoload = null; filetoload = “file.txt”;

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

Page 81: Spoken Language Support for Software Development

81

SPEED Navigation

• Shorthand Editingdown

class Loader {public void load() { InputStream stream = getStream(); String filetoload = null; filetoload = “file.txt”;

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

Page 82: Spoken Language Support for Software Development

82

SPEED Navigation

• Shorthand Editingprotected

class Loader {protected void load() { InputStream stream = getStream(); String filetoload = null; filetoload = “file.txt”;

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

Page 83: Spoken Language Support for Software Development

83

SPEED Navigation

• Shorthand Editingprivate

class Loader {private void load() { InputStream stream = getStream(); String filetoload = null; filetoload = “file.txt”;

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

Page 84: Spoken Language Support for Software Development

84

SPEED Navigation

• Shorthand Editingdown

class Loader {private void load() { InputStream stream = getStream(); String filetoload = null; filetoload = “file.txt”;

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

Page 85: Spoken Language Support for Software Development

85

SPEED Navigation

• Shorthand Editingpush down

class Loader {private void load() { String filetoload = null; InputStream stream = getStream(); filetoload = “file.txt”;

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

Page 86: Spoken Language Support for Software Development

86

SPEED Navigation

• Shorthand Editing • Context-Sensitive

Mouse Grid [Begel]– Related Work: Tree

Hierarchy Navigation [Smith 2004]

class Loader {private void load() { String filetoload = null; InputStream stream = getStream(); filetoload = “file.txt”;

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

Page 87: Spoken Language Support for Software Development

87

SPEED Navigation

• Shorthand Editing • Context-Sensitive

Mouse Grid [Begel]– Related Work: Tree

Hierarchy Navigation [Smith 2004]

class Loader {private void load() { String filetoload = null; InputStream stream = getStream(); filetoload = “file.txt”;

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

1

2

Page 88: Spoken Language Support for Software Development

88

SPEED Navigation

• Shorthand Editing • Context-Sensitive

Mouse Grid [Begel]– Related Work: Tree

Hierarchy Navigation [Smith 2004]

1

class Loader {private void load() { String filetoload = null; InputStream stream = getStream(); filetoload = “file.txt”;

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

1

2

Page 89: Spoken Language Support for Software Development

89

SPEED Navigation

• Shorthand Editing • Context-Sensitive

Mouse Grid [Begel]– Related Work: Tree

Hierarchy Navigation [Smith 2004]

1 1

class Loader {private void load() { String filetoload = null; InputStream stream = getStream(); filetoload = “file.txt”;

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

1

32

4

Page 90: Spoken Language Support for Software Development

90

SPEED Navigation

• Shorthand Editing • Context-Sensitive

Mouse Grid [Begel]– Related Work: Tree

Hierarchy Navigation [Smith 2004]

1 1 3 select

class Loader {private void load() { String filetoload = null; InputStream stream = getStream(); filetoload = “file.txt”;

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

Page 91: Spoken Language Support for Software Development

91

SPEED Editing

• Shorthand Editing • Context-Sensitive

Mouse Grid [Begel]– Related Work: Tree

Hierarchy Navigation [Smith 2004]

edit

class Loader {private void load() { String filetoload = null; InputStream stream = getStream(); filetoload = “file.txt”;

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

filetoload equals quote file.txt quote

Page 92: Spoken Language Support for Software Development

92

SPEED Editing

• Shorthand Editing • Context-Sensitive

Mouse Grid [Begel]– Related Work: Tree

Hierarchy Navigation [Smith 2004]

edit

class Loader {private void load() { String filetoload = null; InputStream stream = getStream(); filetoload = “file.txt”;

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

file to load equals stream dot read string

Page 93: Spoken Language Support for Software Development

93

SPEED Editing

• Shorthand Editing • Context-Sensitive

Mouse Grid [Begel]– Related Work: Tree

Hierarchy Navigation [Smith 2004]

put it back

class Loader {private void load() { String filetoload = null; InputStream stream = getStream(); filetoload = stream.readString();

▌ }public void save() {

...}

}class MenuLoader extends Loader {

...}

file to load equals stream dot read string

Page 94: Spoken Language Support for Software Development

94

Study - SPEED Usability

Goal: Understand how SPEED can be used by expert programmers

1. Train expert Java programmers on SPEED2. Author new code

– Build a Linked List data structure with associated algorithms

3. Modify existing code– Change abstraction representation and update algorithms

Page 95: Spoken Language Support for Software Development

95

Metrics• User Metrics

– Speed– Vocabulary mistakes, Forgotten vocabulary– Grammatical mistakes, Grammatical

substitutions• SPEED Metrics

– Word tokenization errors– Disambiguation errors– Irresolvable ambiguities

Page 96: Spoken Language Support for Software Development

96

Talk Outline

• Introduction and Motivation• Programming by Voice• Program Analyses for Ambiguous Inputs• Program Navigation and Editing Conclusion

Page 97: Spoken Language Support for Software Development

97

Contributions

1. A study of programmers to understand and design a naturally verbalizable input for programming

2. An interactive editor designed for spoken interaction

3. The use of syntax and semantics of programming for disambiguation– Enhanced lexical, syntactic, semantic analyses for

support of verbal ambiguities4. Evaluation of design and tools by studying

programmers using voice for software development

Page 98: Spoken Language Support for Software Development

98

Future of Programming by Voice1. Improved automation of semantic disambiguation

– Use ideas from NLP, Machine Learning (team styles)

2. Early pruning of ambiguities using analysis feedback3. Higher-level linguistic programming tools

– Transformations, Paraphrasing– Phonetic search, Audible feedback

4. Support more software engineering tasks by voice– Debuggers, IDEs, Comments, Code reviews

5. Design spoken variants of other formal languages– General (C, C#) Scripting (PL, OS), Design (HCI),

Command (Robotics), Domain-specific languages (SQL)

Page 99: Spoken Language Support for Software Development

99

Future Research Directions• Data mining the program interaction history

– Task inference, reminders, coding guides• Improving non-code programmer communication

– Design history, Code orientation, Software spelunking • Programming in the “Large”

– Multiple hi-res displays, whiteboards• Visualizing effects of compilation and optimization

– Scalable task-oriented program visualization• Scalable Debugging

– Concurrent apps, long-lived apps

Page 100: Spoken Language Support for Software Development

100

Any Questions?

Andrew Begel: [email protected]