Download presentation
Presentation is loading. Please wait.
Published byJase Crooms Modified over 9 years ago
1
Keyword 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.
2
Keyword Programming
3
Problem src read a line from src, and add it to array array cursor
4
AutoComplete read a line from src, and add it to array
5
AutoComplete read a line from src, and add it to array
6
read a line from src, and add it to array AutoComplete
7
read a line from src, and add it to array
8
AutoComplete read a line from src, and add it to array
9
read a line from src, and add it to array AutoComplete
10
read a line from src, and add it to array AutoComplete
11
read a line from src, and add it to array
12
Keyword Programming read a line from src, and add it to array
13
Keyword Programming read a line from src, and add it to array
14
Keyword Programming read a line from src, and add it to array
15
Keyword Programming read a line from src, and add it to array
16
Keyword Programming read a line from src, and add it to array
17
Related 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
18
Motivation
19
Overview Algorithm Evaluation
20
Algorithm array.add(src.readLine());
21
array.add(src.readLine); array readLine src Algorithm
22
array.add(src.readLine); array readLine src Algorithm BufferedReader StringList
23
array List readLine String BufferedReader src BufferedReader add boolean List, String Algorithm
24
array List readLine String BufferedReader src BufferedReader add boolean List, String Algorithm Function
25
Algorithm Function Database Dynamic Program Extract Tree
26
Function Database array List
27
Function Database array List add boolean List, String
28
Function Database array List add boolean List, String src BufferedReader
29
List Functions array List add boolean List, String src BufferedReader readLine String BufferedReader
30
Function Database array List add boolean List, String src BufferedReader readLine String BufferedReader new String String
31
Score Functions array List add boolean List, String src BufferedReader readLine String BufferedReader new String String
32
Score Functions array List add boolean List, String src BufferedReader readLine String BufferedReader new String String add line
33
1 Score Functions array List add boolean List, String src BufferedReader readLine String BufferedReader new String String add line
34
Score Functions array List add boolean List, String src BufferedReader readLine String BufferedReader new String String add line 11
35
Dynamic Program List BufferedReaderString List booleanBufferedReaderString List booleanBufferedReaderString add List, String srcreadLine BufferedReader arrayadd List, String readLine BufferedReader array boolean array src new String src ? array List add boolean List, String src BufferedReader readLine String BufferedReader new String String 11 add List, String 1 1 1 1 1 11 1 2 1
36
Extract Tree List BufferedReaderString List booleanBufferedReaderString List booleanBufferedReaderString add List, String srcreadLine BufferedReader arrayadd List, String readLine BufferedReader array src new String src 1 2
37
Extract Tree List BufferedReaderString List booleanBufferedReaderString List booleanBufferedReaderString add List, String srcreadLine BufferedReader arrayadd List, String readLine BufferedReader array src new String src 1 2
38
Extract Tree List BufferedReaderString List booleanBufferedReaderString List booleanBufferedReaderString add List, String srcreadLine BufferedReader arrayadd List, String readLine BufferedReader array src new String src 1 2
39
Extract Tree List BufferedReaderString List booleanBufferedReaderString List booleanBufferedReaderString add List, String srcreadLine BufferedReader arrayadd List, String readLine BufferedReader array src new String src 1 2
40
Extract Tree BufferedReader add List, String arrayreadLine BufferedReader src List String boolean
41
Render as Java BufferedReader add List, String arrayreadLine BufferedReader src List String boolean array.add(src.readLine())
42
More Complex.Math.max(x, y).......... Keep best n functions per box max x y..Math.max(x, x).......... 3 Discourage double counting
43
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 Evaluation
44
Artificial Corpus Azureus340 kloc Buddi28 kloc CAROL18 kloc Dnsjava17 kloc Jakarta CC10 kloc jEdit125 kloc jMemorize15 kloc Jmol88 kloc JRuby72 kloc Radeox71 kloc RSSOwl71 kloc Sphinx67 kloc TV-Browser120 kloc Zimbra256 kloc multiple open source repositories Popular Could Compile
45
Artificial Corpus Azureus340 kloc Buddi28 kloc CAROL18 kloc Dnsjava17 kloc Jakarta CC10 kloc jEdit125 kloc jMemorize15 kloc Jmol88 kloc JRuby72 kloc Radeox71 kloc RSSOwl71 kloc Sphinx67 kloc TV-Browser120 kloc Zimbra256 kloc
46
Artificial Corpus RubySymbol.newSymbol(getRuntime(), name)
47
Artificial Corpus RubySymbol.newSymbol(getRuntime(), name) RubySymbol newSymbol getRuntime name
48
Artificial Corpus RubySymbol.newSymbol(getRuntime(), name) RubySymbol newSymbol getRuntime name
49
Artificial Corpus RubySymbol.newSymbol(getRuntime(), name) RubySymbol newSymbol getRuntime name ruby symbol new symbol get runtime name
50
Artificial Corpus RubySymbol.newSymbol(getRuntime(), name) RubySymbol newSymbol getRuntime name ruby symbol new symbol get runtime name name runtime get symbol symbol ruby new
51
Artificial Corpus RubySymbol.newSymbol(getRuntime(), name) name runtime get symbol symbol ruby new
52
Artificial Corpus RubySymbol.newSymbol(getRuntime(), name) name runtime get symbol symbol ruby new Algorithm
53
Artificial Corpus RubySymbol.newSymbol(getRuntime(), name) Algorithm name runtime get symbol symbol ruby new
54
Artificial Corpus RubySymbol.newSymbol(getRuntime(), name) Algorithm Record: - match? - how long? - how many keywords? Record: - match? - how long? - how many keywords? name runtime get symbol symbol ruby new
55
Results overall 91%
56
Results under 500ms
57
Results
59
User Study solicited experienced Java programmers (from college mailing lists) motivated with money —chance to win $20 web based study good data for 49 participants ages: 18 - 74 about 70% students 3 females
60
User Study
62
Results Algorithm as-is CorrectIncorrect vowels.indexOf(c)vowels.index(c) vowels.isIn(c) index of c in vowelscheck vowels for c, return neg -1 if c is in vowels vowels search csearch vowels.charAt(c) vowels.indexOf(c,Integer.SIZE)) c
63
Results Algorithm as-is
64
Results javakey/pseudo usingas-is using algorithm
65
Results javakey/pseudo usingas-is53% using algorithm71%53%
66
Future Work print name of f Integer.valueOf(f.getName()) System.out.print(f.getName()) a priori word weights becomes want of f name print f name 1 1 1 3 1 1 1 3
67
Future Work println f name System.err.println(f.getName()) System.out.println(f.getName()) a priori function weights becomes want println f name 1 1 1 3 println f name 1 1 1 3
68
Future Work synonyms lowercase toLowerCase add vs append spell correction
69
Conclusion array.add(src.readLine());
70
Backup Slides 70
71
E-mail glittle@gmail.com
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.