add cites
[msc-thesis1617.git] / methods.top.tex
1 \section{\acrlong{TOP}}
2 \subsection{\gls{iTasks}}
3 \gls{TOP} is a recent programming paradigm implemented as
4 \gls{iTasks}\cite{achten_introduction_2015} in the pure lazy functional
5 language \gls{Clean}\cite{brus_cleanlanguage_1987}. \gls{iTasks} is a
6 \gls{EDSL} to model workflow tasks in the broadest sense. A \CI{Task} is just
7 a function that, given some state, returns the observable \CI{TaskValue}. The
8 \CI{TaskValue} of a \CI{Task} can have different states. Not all state
9 transitions are possible as shown in Figure~\ref{fig:taskvalue}. Once a value
10 is stable it can never become unstable again. Stability is often reached
11 by pressing a confirmation button. \glspl{Task} yielding a constant value are
12 immediately stable.
13
14 A simple \gls{iTasks} example illustrating the route to stability of a
15 \gls{Task} in which the user has to enter a full name is shown in
16 Listing~\ref{lst:taskex}. The code is accompanied by screenshots showing the
17 user interface in Figure~\ref{fig:taskex1},~\ref{fig:taskex2}
18 and~\ref{fig:taskex3}. The \CI{TaskValue} of the \gls{Task} is in the first
19 image in the \CI{NoValue} state, the second image does not have all the fields
20 filled in and therefore the \CI{TaskValue} remains \CI{Unstable}. In the third
21 image all fields are entered and the \CI{TaskValue} transitions to the
22 \CI{Unstable} state. When the user presses \emph{Continue} the value becomes
23 \CI{Stable} and can not be changed any further.
24
25 \begin{figure}[H]
26 \centering
27 \includegraphics[width=.5\linewidth]{fig-taskvalue}
28 \caption{The states of a \CI{TaskValue}}\label{fig:taskvalue}
29 \end{figure}
30
31 \begin{lstlisting}[language=Clean,label={lst:taskex},%
32 caption={An example \gls{Task} for entering a name}]
33 :: Name = { firstname :: String
34 , lastname :: String
35 }
36
37 derive class iTask Name
38
39 enterInformation :: String [EnterOption m] -> (Task m) | iTask m
40
41 enterName :: Task Name
42 enterName = enterInformation "Enter your name" []
43 \end{lstlisting}
44
45 \begin{figure}[H]
46 \begin{subfigure}{.25\textwidth}
47 \centering
48 \includegraphics[width=.9\linewidth]{taskex1}
49 \caption{Initial interface}\label{fig:taskex1}
50 \end{subfigure}
51 \begin{subfigure}{.25\textwidth}
52 \centering
53 \includegraphics[width=.9\linewidth]{taskex2}
54 \caption{Incomplete entrance}\label{fig:taskex2}
55 \end{subfigure}
56 \begin{subfigure}{.25\textwidth}
57 \centering
58 \includegraphics[width=.9\linewidth]{taskex3}
59 \caption{Complete entry}\label{fig:taskex3}
60 \end{subfigure}
61 \caption{Example of a generated user interface}
62 \end{figure}
63
64 For a type to be suitable it must have instances for a collection of generic
65 functions that are captured in the class \CI{iTask}. Basic types have
66 specialization instances for these functions and show an according interface.
67 Generated interfaces can be modified with decoration operators.
68
69 \subsection{Combinators}
70 \todo{Stukje over combinators, in ieder geval bind en paralel}