more updates
[phd-thesis.git] / intro / intro.tex
index 26bf05d..745a6ab 100644 (file)
@@ -5,15 +5,14 @@
 \begin{document}
 \chapter{Prelude}%
 \label{chp:introduction}
-In 2022, there were an estimated number of 13.4 billion of connected computers that sense, act or otherwise interact with people, other computers and the physical world surrounding us\footnotemark{}.
-\footnotetext{\url{https://transformainsights.com/research/tam/market}, accessed on: \formatdate{2022}{10}{13}}
+In 2022, there were an estimated number of 13.4 billion of connected computers that sense, act or otherwise interact with people, other computers and the physical world surrounding us\footnote{\url{https://transformainsights.com/research/tam/market}, accessed on: \formatdate{13}{10}{2022}}.
 The variety among these devices is considerable but these devices have one thing in common though: they are all controlled by software.
 Concretely this means that programmers write code for these specific device to make sure the brains of the device---the processor---do what we want it to do.
 
-An increasing amount of these connected devices are so-called \emph{edge devices}.
+An increasing amount of these connected devices are so-called \emph{edge devices} that operate in the \gls{IOT}.
 Typically these edge devices are small microprocessors containing various sensors and actuators to interact with the physical world.
 They are often part of and coordinated by a bigger system called \gls{IOT} systems.
-
+The variety among the edge devices and the fact that they differ substantially from other devices makes it complex to program \gls{IOT} systems.
 
 %These ed
 %These edge devices differ very much from other devices we see around us.
@@ -164,39 +163,78 @@ This approach to software development is called \gls{TOSD} \citep{wang_maintaini
                The \gls{UOD} from the business layer is explicitly and separately modelled by the relations that exist in the functions of the host language.
 \end{description}
 
+
+\subsection{\texorpdfstring{\Gls{ITASK}}{ITask}}
 The concept of \gls{TOP} originated from the \gls{ITASK} framework, a declarative workflow language for defining multi-user distributed web applications implemented as an \gls{EDSL} in the lazy pure \gls{FP} language \gls{CLEAN} \citep{plasmeijer_itasks:_2007,plasmeijer_task-oriented_2012}.
-While \gls{ITASK} conceived \gls{TOP}, it is not the only \gls{TOP} language.
-Some \gls{TOP} languages arose from Master's and Bachelor's thesis projects (e.g.\ \textmu{}Task \citep{piers_task-oriented_2016} and LTasks \citep{van_gemert_task_2022}) or were created to solve a practical problem (e.g.\ Toppyt \citep{lijnse_toppyt_2022} and hTask \citep{lubbers_htask_2022}).
+From the structural properties of the data types, the entire user interface is automatically generated.
+
+As an example, \cref{fig:enter_person} shows the \gls{ITASK} code and the corresponding \gls{UI} for a simple task for entering a person.
+From the data type definitions (\crefrange{lst:dt_fro}{lst:dt_to}), using generic programming (\cref{lst:dt_derive}), the \glspl{UI} for the data types are automatically generated.
+Using task combinators (see \cleaninline{>>!} at \cref{lst:task_comb}), the tasks can be combined in sequence.
+Only when the user entered a complete value in the web editor, then the continue button enables and the result can be viewed.
+Special combinators (e.g.\ \cleaninline{@>>} at \cref{lst:task_ui}) are available to tweak the \gls{UI} afterwards.
+
+\begin{figure}[ht]
+       \begin{subfigure}[b]{.525\linewidth}
+               \begin{lstClean}
+:: Person =[+\label{lst:dt_fro}+]
+       { name        :: String
+       , gender      :: Gender
+       , dateOfBirth :: Date
+       }
+
+:: Gender
+       = Male
+       | Female
+       | Other String[+\label{lst:dt_to}+]
+
+derive class iTask Person, Gender[+\label{lst:dt_derive}+]
+
+enterPerson :: Task Person
+enterPerson
+       =   Hint "Enter a person:"
+               @>> enterInformation [] [+\label{lst:task_ui}+]
+       >>! \result -> Hint "You Entered:"[+\label{lst:task_comb}+]
+               @>> viewInformation [] result
+               \end{lstClean}
+               \caption{\Gls{CLEAN} code}
+       \end{subfigure}%
+       \begin{subfigure}[b]{.475\linewidth}
+               \includegraphics[width=\linewidth]{person0}
+               \includegraphics[width=\linewidth]{person1}
+               \includegraphics[width=\linewidth]{person2}
+               \caption{\Glsxtrlong{UI}}
+       \end{subfigure}
+       \caption{The \gls{UI} and code for entering a person in \gls{ITASK}.}%
+       \label{fig:enter_person}
+\end{figure}
 
+\subsection{Other \texorpdfstring{\glsxtrshort{TOP}}{TOP} languages}
+\Citet{steenvoorden_tophat_2022} defines two instruments for \gls{TOP}: \gls{TOP} languages and \gls{TOP} engines.
+A \gls{TOP} language is a formal language to specify workflows.
+A \gls{TOP} engine executes such a specification as a ready-for-work application.
+The \gls{ITASK} system is both a \gls{TOP} language and an engine.
+While \gls{ITASK} conceived \gls{TOP}, it is not the only \gls{TOP} language.
+Some \gls{TOP} languages and systems arose from Master's and Bachelor's thesis projects (e.g.\ \textmu{}Task \citep{piers_task-oriented_2016} and LTasks \citep{van_gemert_task_2022}) or were created to solve a practical problem (e.g.\ Toppyt \citep{lijnse_toppyt_2022} and hTask \citep{lubbers_htask_2022}).
 Furthermore, \gls{TOPHAT} is a fully formally specified \gls{TOP} language designed to capture the essence of \gls{TOP} formally \citep{steenvoorden_tophat_2019}.
- created \textmu{}Task, a \gls{TOP} language for specifying non-interruptible embedded systems implemented as an \gls{EDSL} in \gls{HASKELL}.
-\citet{van_gemert_task_2022} created LTasks, a \gls{TOP} language for interactive terminal applications implemented in LUA, a dynamically typed imperative language.
-\citet{lijnse_toppyt_2022} created Toppyt, a \gls{TOP} language based on \gls{ITASK}, implemented in \gls{PYTHON}, but designed to be simpler and smaller.
-Finally there is \gls{MTASK}, \gls{TOP} language designed for defining workflow for \gls{IOT} devices~\cite{koopman_task-based_2018}.
-It is written in \gls{CLEAN} as an \gls{EDSL} fully integrated with \gls{ITASK} and allows the programmer to define all layers of an \gls{IOT} system from a single source.
-
-\section{Reading guide}\label{sec:outline}
-This thesis presents a novel view on programming these \gls{IOT} systems as a purely functional rhapsody in three episodes.
+It is also possible to translate \gls{TOPHAT} code to \gls{ITASK} to piggyback on the \gls{TOP} engine it offers.
+
+\subsection{\texorpdfstring{\Gls{MTASK}}{MTask}}
+Finally there is \gls{MTASK}, a \gls{TOP} language designed for defining workflows for \gls{IOT} edge devices \citep{koopman_task-based_2018}.
+It is written in \gls{CLEAN} as a multi-view \gls{EDSL} fully integrated with \gls{ITASK}.
+Together with \gls{ITASK}, it allows the programmer to define all layers of an \gls{IOT} system from a single declarative specification.
+The domain-specific nature of the language allows for a very compact binary representation of the work that needs to be done.
+This specification can be interpreted on a device that runs the \gls{MTASK} \gls{RTS}, a domain-specific \gls{TOP} engine implemented as a feather-light domain-specific \gls{OS}.
+
+\section{Reading guide and contributions}\label{sec:contributions}
+This novel view on programming \gls{IOT} systems is presented in the thesis as a purely functional rhapsody in three episodes.
 On Wikipedia, a rhapsody is defined as follows \citep{wikipedia_contributors_rhapsody_2022}:
 \begin{quote}
        \emph{A \emph{rhapsody} in music is a one-movement work that is episodic yet integrated, free-flowing in structure, featuring a range of highly contrasted moods, colour, and tonality.
        An air of spontaneous inspiration and a sense of improvisation make it freer in form than a set of variations.}
 \end{quote}
 
-\subsection*{\nameref{chp:introduction}}
-\Cref{chp:introduction} introduces the contents of the thesis, provides background material on \gls{IOT}, \glspl{DSL} and \gls{TOP} (\cref{sec:back_iot}, \cref{sec:back_dsl}, and \cref{sec:back_top} respectively) and an overview of the contributions including a more technical outline in \cref{sec:contributions}.
-
-\subsection*{\Fullref{prt:dsl}}
-
-\subsection*{\Fullref{prt:top}}
-
-\subsection*{\Fullref{prt:tvt}}
-
-\subsection*{\nameref{chp:conclusion}}
-\Cref{chp:conclusion} wraps up with the coda that provides discussion and an outlook on future work.
-
-\section{Contributions}\label{sec:contributions}
-\subsection*{\nameref{prt:dsl}}
+\subsection{\nameref{prt:dsl}}
 The \gls{MTASK} system is a heterogeneous \gls{EDSL} and during the development of it, several novel basal techniques for embedding \glspl{DSL} in \gls{FP} languages have been found.
 This first episode is a cumulative---otherwise known as paper-based---episode consisting of two papers published on novel embedding techniques.
 Both papers are readable independently.
@@ -206,18 +244,19 @@ This chapter is based on the paper: \citeentry{lubbers_deep_2022}\todo{change in
 
 While supervising \citeauthor{amazonas_cabral_de_andrade_developing_2018}'s \citeyear{amazonas_cabral_de_andrade_developing_2018} Master's thesis, focussing on an early version of \gls{MTASK}, a seed was planted for a novel deep embedding technique for \glspl{DSL} where the resulting language is extendible both in constructs and in interpretation using type classes and existential data types.
 Slowly the ideas organically grew to form the technique shown in the paper.
-\Cref{sec:classy_reprise} was added after publication and contains a (yet) unpublished extension of the embedding technique.
+The related work section is updated with the research found only after publication.
+\Cref{sec:classy_reprise} was added after publication and contains a (yet) unpublished extension of the embedding technique for reducing the required boilerplate.
 The research from this paper and writing the paper was solely performed by me.
 
 \subsubsection*{\Fullref{chp:first-class_datatypes}}
 This chapter is based on the paper: \citeentry{lubbers_first-class_2022}\todo{change when accepted}.
 
 It shows how to inherit data types from the host language in \glspl{EDSL} using metaprogramming.
-It does so by providing a proof-of-concept implementation using \gls{HASKELL}'s metaprogramming system: \gls{TH}.
-Besides showing the result, the paper also serves as a gentle introduction to using \gls{TH} and contains a thorough literature study on research that uses \gls{TH}.
+It does so by providing a proof-of-concept implementation using \gls{HASKELL}'s metaprogramming system: \glsxtrlong{TH}.
+Besides showing the result, the paper also serves as a gentle introduction to using \glsxtrlong{TH} and contains a thorough literature study on research that uses \glsxtrlong{TH}.
 The research in this paper and writing the paper was performed by me, though there were weekly meetings with Pieter Koopman and Rinus Plasmeijer in which we discussed and refined the ideas.
 
-\subsection*{\nameref{prt:top}}
+\subsection{\nameref{prt:top}}
 This is a monograph compiled from several papers and revised lecture notes on \gls{MTASK}, the \gls{TOP} system used to orchestrate the \gls{IOT}.
 It provides a gentle introduction to the \gls{MTASK} system elaborates on \gls{TOP} for the \gls{IOT}.
 \todo[inline]{outline the chapters}
@@ -225,52 +264,63 @@ It provides a gentle introduction to the \gls{MTASK} system elaborates on \gls{T
 \begin{itemize}
        \item \citeentry{koopman_task-based_2018}
 
-               This was the initial \gls{TOP}/\gls{MTASK} paper.
+               This is the initial \gls{TOP}/\gls{MTASK} paper.
+               It provides an overview of the initial \gls{MTASK} language and shows first versions of a pretty printer, an \gls{ITASK} simulation and a \gls{C} code generation view.
+               \paragraph{Contribution}
                Pieter Koopman wrote it, I helped with the software and research.
        \item \citeentry{lubbers_task_2018}
                
                This paper was an extension of my Master's thesis \citep{lubbers_task_2017}.
                It shows how a simple imperative variant of \gls{MTASK} was integrated with \gls{ITASK}.
                While the language was a lot different than later versions, the integration mechanism is still used in \gls{MTASK} today.
+               \paragraph{Contribution}
                The research in this paper and writing the paper was performed by me, though there were weekly meetings with Pieter Koopman and Rinus Plasmeijer in which we discussed and refined the ideas.
        \item \citeentry{lubbers_multitasking_2019}\footnote{%
                This work acknowledges the support of the ERASMUS+ project ``Focusing Education on Composability, Comprehensibility and Correctness of Working Software'', no. 2017--1--SK01--KA203--035402
                }
 
                This paper was a short paper on the multitasking capabilities of \gls{MTASK} in contrast to traditional multitasking methods for \gls{ARDUINO}.
+               \paragraph{Contribution}
                The research in this paper and writing the paper was performed by me, though there were weekly meetings with Pieter Koopman and Rinus Plasmeijer.
        \item \citeentry{koopman_simulation_2018}\footnotemark[\value{footnote}]\todo{change when published}
 
                These revised lecture notes are from a course on the \gls{MTASK} simulator was provided at the 2018 \gls{CEFP}/\gls{3COWS} winter school in Ko\v{s}ice, Slovakia.
+               \paragraph{Contribution}
                Pieter Koopman wrote and taught it, I helped with the software and research.
        \item \citeentry{lubbers_writing_2019}\footnotemark[\value{footnote}]\todo{change when published}
 
                These revised lecture notes are from a course on programming in \gls{MTASK} provided at the 2019 \gls{CEFP}/\gls{3COWS} summer school in Budapest, Hungary.
+               \paragraph{Contribution}
                Pieter Koopman prepared and taught half of the lecture and supervised the practical session.
                I taught the other half of the lecture, wrote the lecture notes, made the assignments and supervised the practical session.
        \item \citeentry{lubbers_interpreting_2019}
 
                This paper shows an implementation for \gls{MTASK} for microcontrollers in the form of a compilation scheme and informal semantics description.
+               \paragraph{Contribution}
                The research in this paper and writing the paper was performed by me, though there were weekly meetings with Pieter Koopman and Rinus Plasmeijer.
        \item \citeentry{crooijmans_reducing_2022}\todo{change when published}
 
                This paper shows how to create a scheduler so that devices running \gls{MTASK} tasks can go to sleep more automatically.
+               \paragraph{Contribution}
                The research was carried out by \citet{crooijmans_reducing_2021} during his Master's thesis.
                I did the daily supervision and helped with the research, Pieter Koopman was the formal supervisor and wrote most of the paper.
        \item \emph{Green Computing for the Internet of Things}\footnote{
                This work acknowledges the support of the Erasmus+ project ``SusTrainable---Promoting Sustainability as a Fundamental Driver in Software Development Training and Education'', no. 2020--1--PT01--KA203--078646}\todo{change when published}
 
+               \paragraph{Contribution}
                These revised lecture notes are from a course on sustainable programming using \gls{MTASK} provided at the 2022 SusTrainable summer school in Rijeka, Croatia.
                Pieter prepared and taught a quarter of the lecture and supervised the practical session.
                I prepared and taught the other three quarters of the lecture, made the assignments and supervised the practical session\todo{writing contribution}.
 \end{itemize}
 
-\subsection*{\nameref{prt:tvt}}
+\subsection{\nameref{prt:tvt}}
 \Cref{prt:tvt} is based on a journal paper that quantitatively and qualitatively compares traditional \gls{IOT} architectures with \gls{IOT} systems using \gls{TOP} and contains a single chapter.
 This chapter is based on the journal paper: \citeentry{lubbers_could_2022}\todo{change when published}\footnote{This work is an extension of the conference article: \citeentry{lubbers_tiered_2020}\footnotemark{}}.
 \footnotetext{This paper was partly funded by the Radboud-Glasgow Collaboration Fund.}
 
 It compares programming traditional tiered architectures to tierless architectures by showing a qualitative and a quantitative four-way comparison of a smart-campus application.
+
+\paragraph{Contribution}
 Writing the paper was performed by all authors.
 I created the server application, the \gls{CLEAN}/\gls{ITASK}/\gls{MTASK} implementation (\glsxtrshort{CWS}) and the \gls{CLEAN}/\gls{ITASK} implementation (\glsxtrshort{CRS})
 Adrian Ramsingh created the \gls{MICROPYTHON} implementation (\glsxtrshort{PWS}), the original \gls{PYTHON} implementation (\glsxtrshort{PRS}) and the server application were created by \citet{hentschel_supersensors:_2016}.