Title: Keyword Programming in Java
1Keyword Programming in Java
- Greg Little and Robert C. Miller
- MIT CSAIL
- This work was supported in part by the National
Science Foundation under award number
IIS-0447800, - and by Quanta Computer as part of the TParty
project.
2Keyword Programming
3Problem
src
array
cursor
4AutoComplete
5AutoComplete
6AutoComplete
7AutoComplete
8AutoComplete
9AutoComplete
10AutoComplete
11AutoComplete
12Keyword Programming
13Keyword Programming
14Keyword Programming
15Keyword Programming
16Keyword Programming
17Related Work
AutoComplete syntactically valid prefix
Jungloids Mandelin et al PLDI 05 XSnippet
Sahavechaphan et al OOPSLA 06 input and output
types
Keyword Programming keywords from expression
18Motivation
19Overview
20Algorithm
array.add(src.readLine())
21Algorithm
array.add(src.readLine) array
readLine src
22Algorithm
array.add(src.readLine) array
readLine src
String
ListltStringgt
BufferedReader
23Algorithm
24Algorithm
Function
25Algorithm
Function Database
Dynamic Program
Extract Tree
26Function Database
27Function Database
28Function Database
29List Functions
30Function Database
31Score Functions
32Score Functions
add line
33Score Functions
add line
34Score Functions
add line
35Dynamic Program
src
array
array
src
boolean
array
src
new String
?
36Extract Tree
src
array
array
src
array
src
new String
37Extract Tree
src
array
array
src
array
src
new String
38Extract Tree
src
array
array
src
array
src
new String
39Extract Tree
src
array
array
src
array
src
new String
40Extract Tree
boolean
array
BufferedReader
src
41Render as Java
array.add(src.readLine())
boolean
array
BufferedReader
src
42More Complex
.Math.max(x, y)..........
Keep best n functions per box
max x y .
.Math.max(x, x)..........
Discourage double counting
43Evaluation
Artificial Corpus
sense of speed in real projects
sense of accuracy in wide variety of contexts
User Study
sense of accuracy on real inputs
sense for how real inputs look
44Artificial Corpus
multiple open source repositories
Popular
Could Compile
45Artificial Corpus
46Artificial Corpus
RubySymbol.newSymbol(getRuntime(), name)
47Artificial Corpus
RubySymbol.newSymbol(getRuntime(), name)
RubySymbol newSymbol getRuntime name
48Artificial Corpus
RubySymbol.newSymbol(getRuntime(), name)
RubySymbol newSymbol getRuntime name Ruby
Symbol new Symbol get Runtime name
49Artificial Corpus
RubySymbol.newSymbol(getRuntime(), name)
RubySymbol newSymbol getRuntime name Ruby
Symbol new Symbol get Runtime name ruby symbol
new symbol get runtime name
50Artificial Corpus
RubySymbol.newSymbol(getRuntime(), name)
RubySymbol newSymbol getRuntime name Ruby
Symbol new Symbol get Runtime name ruby symbol
new symbol get runtime name name runtime get
symbol symbol ruby new
51Artificial Corpus
RubySymbol.newSymbol(getRuntime(), name)
name runtime get symbol symbol ruby new
52Artificial Corpus
RubySymbol.newSymbol(getRuntime(), name)
name runtime get symbol symbol ruby new
Algorithm
53Artificial Corpus
RubySymbol.newSymbol(getRuntime(), name)
name runtime get symbol symbol ruby new
Algorithm
54Artificial Corpus
RubySymbol.newSymbol(getRuntime(), name)
- Record
- - match?
- how long?
- how many keywords?
name runtime get symbol symbol ruby new
Algorithm
55Results
overall 91
56Results
under 500ms
57Results
58Results
59User Study
solicited experienced Java programmers (from
college mailing lists)
motivated with moneychance to win 20
web based study
good data for 49 participants
ages 18 - 74
about 70 students
3 females
60User Study
61User Study
62Results
Correct
Incorrect
as-is
vowels.indexOf(c)
vowels.index(c)
vowels.index(c)
vowels.isIn(c)
vowels.charAt(c)
Algorithm
index of c in vowels
check vowels for c, return neg -1 if c is in
vowels
vowels.indexOf(c,Integer.SIZE))
vowels search c
search
c
63Results
as-is
Algorithm
64Results
java
key/pseudo
using
as
-
is
using algorithm
65Results
java
key/pseudo
using
as
-
is
53
using algorithm
71
53
66Future Work
a priori word weights
print name of f
want
becomes
System.out.print(f.getName())
Integer.valueOf(f.getName())
of f name
print f name
67Future Work
a priori function weights
println f name
want
becomes
System.out.println(f.getName())
System.err.println(f.getName())
println f name
println f name
68Future Work
spell correction
lowercase
toLowerCase
synonyms
add vs append
69Conclusion
array.add(src.readLine())
70Backup Slides
71E-mail
glittle_at_gmail.com
72(No Transcript)
73(No Transcript)
74(No Transcript)
75(No Transcript)
76(No Transcript)
77(No Transcript)
78(No Transcript)
79(No Transcript)
80(No Transcript)