Commit 0f1ecfc3398655eb2ea8cf30551385857d42b777

Authored by Geoffrey Challen
1 parent b6686674

Final pass.

introduction.tex
... ... @@ -19,7 +19,7 @@ Today programmers are forced to anticipate these changing conditions at
19 19 development time and implement the required adaptation themselves.
20 20 Figure~\ref{fig-example-if} shows an example of an Android app attempting to
21 21 adapt to the device's battery level by establishing regular- and low-battery
22   -code paths, with the latter attempting to save energy, possibly by utilizing
  22 +code paths, with the latter attempting to save energy---possibly by utilizing
23 23 a slower but more energy-efficient algorithm, computing an approximate
24 24 result, or deferring the computation.
25 25  
... ... @@ -28,22 +28,22 @@ important is perhaps the least obvious: it is unclear that the different code
28 28 paths achieve the desired result. There may be no differences between the
29 29 alternatives (neither conserves energy), the alternative designed to conserve
30 30 energy may actually consume more due to bugs or incorrect assumptions, or the
31   -result may also depend on some other factor not considered by the programmer,
32   -such as the type of network the device is currently using.
  31 +outcome may depend on other factors not considered by the programmer, such as
  32 +the type of network the device is currently using.
33 33  
34   -In addition, adaptive programming frequently requires arbitrary decision
35   -thresholds chosen before deployment. Even if the two code paths shown in
  34 +In addition, attempts at pre-deployment adaptation frequently produce
  35 +arbitrary decision thresholds. Even if the two code paths in
36 36 Figure~\ref{fig-example-if} achieve the desired result, it is unclear what
37   -the threshold for choosing a path should be, whether a single threshold
38   -will work for all users, and whether the threshold should depend on
39   -other factors such as how frequently the app is used.
  37 +battery level threshold should trigger the energy-saving path, whether a
  38 +single threshold will work for all users, and whether the threshold should
  39 +depend on other factors such as how frequently the app is used.
40 40  
41 41 \begin{figure}[t]
42 42 \begin{minted}[fontsize=\footnotesize]{java}
43 43 if (plugged == false && batteryLevel < 10) {
44   - // Attempt to save energy
  44 + // Try to save energy
45 45 } else {
46   - // Don't attempt to save energy
  46 + // Don't try to save energy
47 47 }
48 48 \end{minted}
49 49  
... ... @@ -61,64 +61,66 @@ only for certain users, only on certain devices, or never.}
61 61  
62 62 Finally, the current approach to adaptation fails to support post-deployment
63 63 testing. While it is possible to enable flexibility, runtime adaptation, and
64   -split testing using the languages typically used to program mobile systems,
65   -these common tasks require writing large amounts of error-prone boilerplate
66   -code, including APIs to adjust values at runtime and code to retrieve
67   -settings from remote servers.
68   -
69   -The root of the problem is that \textbf{today's languages force programmers to
70   -be certain at a moment when they cannot be}: at development time. While this
71   -problem is endemic to existing programming languages, when developing mobile
72   -apps it is magnified by the amount of variation developers must confront. Our
73   -solution is simple: (1) provide developers with a way to express
74   -\textit{structured uncertainty}, and (2) use the resulting flexibility to
75   -enable a large array of downstream tools for resolving uncertainty by
76   -choosing from the alternatives provided by the developer.
  64 +split testing using the languages currently used to program mobile systems,
  65 +these tasks require writing large amounts of error-prone boilerplate code
  66 +that retrieves settings from remote servers and adjusts values at runtime.
  67 +
  68 +The root of the problem is that \textbf{today's languages force programmers
  69 +to be certain at a moment when they cannot be: at development time.} While
  70 +this problem is endemic to existing programming languages, when developing
  71 +mobile apps it is magnified by the amount of variation developers must
  72 +confront. Our solution is simple: (1) provide developers with a way to
  73 +express \textit{structured uncertainty}, and (2) use the resulting
  74 +flexibility to enable a large array of downstream tools for resolving
  75 +uncertainty by choosing from the alternatives provided by the developer.
77 76  
78 77 \begin{figure}[t]
79 78  
80 79 \begin{minted}[fontsize=\footnotesize]{java}
81 80 maybe {
82   - // Attempt to save energy
  81 + // Try to save energy (Alternative 1)
83 82 } or {
84   - // Don't attempt to save energy
  83 + // Don't to save energy (Alternative 2)
85 84 }
86 85 \end{minted}
87 86  
88   -\vspace*{-0.1in}
  87 +\vspace*{-0.2in}
89 88  
90   -\caption{\small\textbf{Example \texttt{maybe} Statement.} The programmer provides
91   -multiple equivalent alternatives. The system determines how to choose between
92   -them at runtime.}
  89 +\caption{\small\textbf{Example \texttt{maybe} Statement.} The programmer
  90 +provides multiple alternatives. The system determines how to choose between
  91 +them.}
93 92  
94 93 \label{fig-example-maybe}
95 94  
96   -\vspace*{-0.1in}
  95 +\vspace*{-0.2in}
97 96  
98 97 \end{figure}
99 98  
100   -In this paper, we present a novel a language construct for expressing
101   -structured uncertainty: the \texttt{maybe} statement. Unlike previous
102   -approaches to adaptation that relied on language support, \texttt{maybe} does
103   -not encourage programmers to provide more information about their app to
104   -allow the compiler to improve performance or guarantee correctness. Rather,
105   -\texttt{maybe} allows the programmer to express and structure uncertainty by
106   -providing two or more different \textit{alternatives} implementing multiple
107   -approaches to runtime adaptation, possibly by making the same
108   -energy-performance or energy-accuracy tradeoffs described previously.
109   -Conceptually, \texttt{maybe} extends the process of compilation and
110   -optimization to include post-deployment testing while also enabling flexible
111   -adaptation that may produce per-user, per-device, or time-varying solutions.
  99 +\sloppypar{In this paper, we present a novel a language construct for
  100 +expressing structured uncertainty: the \texttt{maybe} statement. Unlike
  101 +previous approaches to adaptation that relied on language support,
  102 +\texttt{maybe} does not encourage programmers to provide more information
  103 +about their app to allow the compiler to improve performance or guarantee
  104 +correctness. Rather, \texttt{maybe} allows the programmer to express and
  105 +structure uncertainty by providing two or more different
  106 +\textit{alternatives} implementing multiple approaches to runtime adaptation.
  107 +Together, multiple alternatives can produce the same energy-performance or
  108 +energy-accuracy tradeoffs described previously. Conceptually, \texttt{maybe}
  109 +extends the process of compilation and optimization to include
  110 +post-deployment testing while also enabling flexible adaptation that may
  111 +produce per-user, per-device, or time-varying decisions.}
112 112  
113 113 Figure~\ref{fig-example-maybe} shows how our earlier example can be easily
114   -rewritten using a \texttt{maybe} statement. Unlike the previous example
115   -\texttt{maybe}, does not rely on the developer to implement a decision process
116   -or correctly anticipate the effects of each alternative. Instead, the
  114 +rewritten using a \texttt{maybe} statement. Unlike the previous example,
  115 +\texttt{maybe} does not rely on the developer to implement a decision process
  116 +or correctly predict the effects of each alternative. Instead, the
117 117 \texttt{maybe} system makes runtime choices about which alternative to use by
118 118 measuring the tradeoffs produced by each alternative and (in this case)
119   -activating an energy-saving alternative when appropriate. All the developer
120   -has to do is provide alternatives when they are unsure what to do; the
121   -\texttt{maybe} system does the rest.
  119 +activating an energy-saving alternative when appropriate. When they are
  120 +unsure what to do, all developers have to do is provide alternatives; the
  121 +\texttt{maybe} system does the rest. \texttt{maybe} allows developers to
  122 +respond to uncertainty with flexibility, which is used to enable
  123 +testing-driven adaptation.
122 124  
123 125 The rest of our paper is structured as follows. We begin by providing a more
124 126 complete description of the \texttt{maybe} statement in
... ...
maybe.tex
... ... @@ -30,13 +30,13 @@ maybe {
30 30  
31 31 \end{minted}
32 32  
33   -\vspace*{-0.1in}
  33 +\vspace*{-0.2in}
34 34  
35 35 \caption{\small\textbf{More \texttt{maybe} Statements}}
36 36  
37 37 \label{fig-maybeexamples}
38 38  
39   -\vspace*{-0.15in}
  39 +\vspace*{-0.2in}
40 40  
41 41 \end{figure}
42 42  
... ... @@ -60,14 +60,14 @@ alternatives are specified, the system chooses one to execute; if only one
60 60 alternative is specified, the system chooses whether or not to execute it.
61 61 Single-alternative \texttt{maybe} statements can encapsulate or reorganize
62 62 logic that does not affect correctness, but may (or may not) produce some
63   -desirable objective.
  63 +desirable outcome.
64 64  
65 65 Figure~\ref{fig-maybeexamples} shows several extensions of the \texttt{maybe}
66 66 statement providing syntactic sugar. \texttt{maybe} function annotations
67 67 allow uncertainty to be expressed at the function level, with the
68 68 alternatives consisting of multiple function definitions with identical
69   -signatures. Finally, \texttt{maybe} statements that require custom evaluation
70   -logic can include an \texttt{evaluate} block as shown in the final example.
  69 +signatures. \texttt{maybe} statements that require custom evaluation logic
  70 +can include an \texttt{evaluate} block as shown in the final example.
71 71 \texttt{evaluate} blocks provide app-specific \textit{a posteriori} logic to
72 72 evaluate the selected alternative. The \texttt{evaluate} block must return a
73 73 single JSON object with two components: (1) a positive integer
... ... @@ -80,11 +80,11 @@ While it should be possible to nest \texttt{maybe} statements, it may require
80 80 compiler support to provide guarantees about how \texttt{maybe} decisions are
81 81 maintained across multiple code blocks. As we gain more experience with our
82 82 rewrite-based prototype, described next in Section~\ref{sec-certainty}, we
83   -will revisit the question of nesting in future compiler-driven \texttt{maybe}
  83 +will revisit the question of nesting in future compiler-based \texttt{maybe}
84 84 systems.
85 85  
86   -\sloppypar{As a final remark, note that structured uncertainty is not
87   -randomness. Randomness weights multiple options statically---there is no
88   -right or wrong choice. In contrast, the \texttt{maybe} statement indicates
89   -that during any given execution one alternative may be the right
90   -choice---even if the developer or system cannot yet identify it.}
  86 +As a final remark, note that structured uncertainty is not randomness.
  87 +Randomness weights multiple options statically---there is no right or wrong
  88 +decision. In contrast, the \texttt{maybe} statement indicates that during any
  89 +given execution one alternative may better than the others. The goal of the
  90 +system is to determine which one.
... ...
paper.tex
... ... @@ -82,7 +82,6 @@ Jinghao Shi, Guru Prasad Srinivasa, and Lukasz Ziarek}
82 82 \input{conclusion.tex}
83 83  
84 84 {\scriptsize
85   -\balance
86 85 \renewcommand{\baselinestretch}{0.8}
87 86 \bibliographystyle{acm}
88 87 \bibliography{references}
... ...