updates
authorMart Lubbers <mart@martlubbers.net>
Mon, 21 Nov 2022 18:31:35 +0000 (19:31 +0100)
committerMart Lubbers <mart@martlubbers.net>
Mon, 21 Nov 2022 18:31:35 +0000 (19:31 +0100)
12 files changed:
intro/img/.gitignore [new file with mode: 0644]
intro/img/Makefile [new file with mode: 0644]
intro/img/person0.jpg
intro/img/person0g.jpg [deleted file]
intro/img/person1.jpg
intro/img/person1g.jpg [deleted file]
intro/img/person2.jpg
intro/img/person2g.jpg [deleted file]
intro/intro.tex
intro/iot-layers.tex
intro/tosd.tex
intro/traditional.tex

diff --git a/intro/img/.gitignore b/intro/img/.gitignore
new file mode 100644 (file)
index 0000000..ddcb517
--- /dev/null
@@ -0,0 +1 @@
+*g.jpg
diff --git a/intro/img/Makefile b/intro/img/Makefile
new file mode 100644 (file)
index 0000000..2447e28
--- /dev/null
@@ -0,0 +1,2 @@
+%g.jpg: %.jpg
+       convert $< -set colorspace Gray -separate -average $@
index 885d791..ef9a0cc 100644 (file)
Binary files a/intro/img/person0.jpg and b/intro/img/person0.jpg differ
diff --git a/intro/img/person0g.jpg b/intro/img/person0g.jpg
deleted file mode 100644 (file)
index da60bce..0000000
Binary files a/intro/img/person0g.jpg and /dev/null differ
index 7a5d812..07f5e7b 100644 (file)
Binary files a/intro/img/person1.jpg and b/intro/img/person1.jpg differ
diff --git a/intro/img/person1g.jpg b/intro/img/person1g.jpg
deleted file mode 100644 (file)
index 932165d..0000000
Binary files a/intro/img/person1g.jpg and /dev/null differ
index 311eb93..a5547d7 100644 (file)
Binary files a/intro/img/person2.jpg and b/intro/img/person2.jpg differ
diff --git a/intro/img/person2g.jpg b/intro/img/person2g.jpg
deleted file mode 100644 (file)
index cc7db44..0000000
Binary files a/intro/img/person2g.jpg and /dev/null differ
index be52195..3eb6a34 100644 (file)
@@ -119,57 +119,59 @@ However, the hardware requirements can be reduced by embedding domain-specific d
 
 \section{\texorpdfstring{\Glsxtrlongpl{DSL}}{Domain-specific languages}}\label{sec:back_dsl}
 % General
-Programming languages can be divided up into two categories: \glspl{DSL}\footnote{Historically this has been called DSEL as well.} and \glspl{GPL} \citep{fowler_domain_2010}.
+Programming languages can be divided up into two categories: \glspl{DSL}\footnote{Historically \glsxtrshortpl{DSL} have been called DSELs as well.} and \glspl{GPL} \citep{fowler_domain_2010}.
 Where \glspl{GPL} are not made with a demarcated area in mind, \glspl{DSL} are tailor-made for a specific domain.
 Writing idiomatic domain-specific code in an \gls{DSL} is easy but this may come at the cost of the \gls{DSL} being less expressive to an extent that it may not even be Turing complete.
-\Glspl{DSL} come in two main flavours: standalone and embedded (\cref{sec:standalone_embedded})\footnote{Also called external and internal respectively.} of which \glspl{EDSL} can again be classified into heterogeneous and homogeneous languages (\cref{sec:hetero_homo}).
+\Glspl{DSL} come in two main flavours: standalone and embedded (\cref{sec:standalone_embedded})\footnote{Standalone and embedded are also called external and internal respectively.} of which \glspl{EDSL} can further be classified into heterogeneous and homogeneous languages (\cref{sec:hetero_homo}).
 This hyponymy is shown in \cref{fig:hyponymy_of_dsls}.
 
 \begin{figure}[ht]
        \centering
        \includestandalone{hyponymy_of_dsls}
-       \caption{Hyponymy of \glspl{DSL} (adapted from \citet[\citepage{2}]{mernik_extensible_2013})}%
+       \caption{A hyponymy of \glspl{DSL} (adapted from \citet[\citepage{2}]{mernik_extensible_2013})}%
        \label{fig:hyponymy_of_dsls}
 \end{figure}
 
 \subsection{Standalone and embedded}\label{sec:standalone_embedded}
-\glspl{DSL} where historically created as standalone languages, meaning all the machinery is developed solely for the language.
+\glspl{DSL} where historically created as standalone languages, meaning that all machinery is developed solely for the language.
 The advantage of this approach is that the language designer is free to define the syntax and type system of the language as they wish, not being restricted by any constraint.
-Unfortunately it also means that they need to develop a compiler or interpreter for the language to be usable making standalone \glspl{DSL} costly to create.
+Unfortunately it also means that they need to develop a compiler or interpreter for the language, making standalone \glspl{DSL} costly to create.
 Examples of standalone \glspl{DSL} are regular expressions, make, yacc, XML, SQL, \etc.
 
 The dichotomous approach is embedding the \gls{DSL} in a host language, i.e.\ \glspl{EDSL} \citep{hudak_modular_1998}.
-By defining the language as constructs in the host language, much of the machinery is inherited and the cost of creating embedded languages is very low.
-There is more linguistic reuse \citep{krishnamurthi_linguistic_2001}.
+By defining the language as constructs in the host language, much of the machinery is inherited \citep{krishnamurthi_linguistic_2001}.
+This greatly reduces the cost of creating embedded languages.
 However, there are two sides to this coin.
 If the syntax of the host language is not very flexible, the syntax of the \gls{DSL} may become clumsy.
-Furthermore, errors shown to the programmer may be larded with host language errors, making it difficult for a non-expert of the host language to work with the \gls{DSL}.
-Pure \gls{FP} languages are especially suitable for hosting embedded \glspl{DSL} because they have strong and versatile type systems, minimal but flexible syntax and offer referential transparency.
+Furthermore, \gls{DSL} errors shown to the programmer may be larded with host language errors, making it difficult for a non-expert of the host language to work with the \gls{DSL}.
+\Gls{FP} languages are especially suitable for hosting embedded \glspl{DSL} because they often have strong and versatile type systems, minimal but flexible syntax and offer referential transparency.
 
 \subsection{Heterogeneity and homogeneity}\label{sec:hetero_homo}
 \Citet{tratt_domain_2008} applied a notion from metaprogramming \citep{sheard_accomplishments_2001} to \glspl{EDSL} to define homogeneity and heterogeneity of \glspl{EDSL} as follows:
 
 \begin{quote}
-       \emph{
-       A homogeneous system is one where all the components are specifically designed to work with each other, whereas in heterogeneous systems at least one of the components is largely, or completely, ignorant of the existence of the other parts of the system.
+       \emph{A homogeneous system is one where all the components are specifically designed to work with each other, whereas in heterogeneous systems at least one of the components is largely, or completely, ignorant of the existence of the other parts of the system.
 }
 \end{quote}
 
 Homogeneous \glspl{EDSL} are therefore languages that are solely defined as an extension to their host language.
 They often restrict features of the host language to provide a safer interface or capture an idiomatic pattern in the host language for reuse.
 The difference between a library and a homogeneous \glspl{EDSL} is not always clear.
-Examples of homogeneous \glspl{EDSL} are libraries such as ones for sets, \glspl{GUI} creation, LISP's macro system, \etc.
+Examples of homogeneous \glspl{EDSL} are libraries such as ones for sets, regions, but also more complex tasks such as \glspl{GUI}.
 
 On the other hand, heterogeneous \glspl{EDSL} are languages that are not executed in the host language.
-For example, \citep{elliott_compiling_2003} describe the language Pan, for which the final representation in the host language is a compiler that will, when executed, generate code for a completely different target platform.
-In fact, \gls{ITASK} and \gls{MTASK} are both heterogeneous \glspl{EDSL} and \gls{MTASK} specifically is a compiling \gls{DSL}.
+For example, \citet{elliott_compiling_2003} describe the language Pan, for which the final representation in the host language is a compiler that will, when executed, generate code for a completely different target platform.
+In fact, \gls{ITASK} and \gls{MTASK} are embedded \glspl{DSL}.
+\Gls{ITASK} runs in its host language as well so it is a homogeneous \gls{DSL}.
+Tasks written using \gls{MTASK} are serialised and executed on \gls{IOT} edge devices and it is therefore a heterogeneous \gls{DSL}.
 
 \section{\texorpdfstring{\Glsxtrlong{TOP}}{Task-oriented programming}}\label{sec:back_top}
-\Gls{TOP} is a declarative programming paradigm designed to model interactive systems \citep{plasmeijer_task-oriented_2012}.
+\Gls{TOP} is a recent declarative programming paradigm for modelling interactive systems \citep{plasmeijer_task-oriented_2012}.
 \Citet{steenvoorden_tophat_2022} defines two instruments for \gls{TOP}: \gls{TOP} languages and \gls{TOP} engines.
-A \gls{TOP} language is the language to specify interactive systems.
-A \gls{TOP} engine is software or hardware that executes such a specification as a ready-for-work application.
-Instead of dividing problems into \gls{LSOC} it deals with separation of concerns in a novel way.
+The language is the \emph{formal} language for specifying interactive systems.
+The engine is the software or hardware that executes these specifications as a ready-for-work application.
+In \gls{TOP} languages, tasks are the basic building blocks and they represent the actual work.
+Instead of dividing problems into \gls{LSOC} \gls{TOP} deals with separation of concerns in a novel way.
 From the data types, utilising various \emph{type-parametrised} concepts, all other aspects are handled automatically (see \cref{fig:tosd}).
 This approach to software development is called \gls{TOSD} \citep{wang_maintaining_2018}.
 
@@ -185,45 +187,49 @@ This approach to software development is called \gls{TOSD} \citep{wang_maintaini
                \includestandalone{tosd}
                \caption{\Gls{TOSD} approach.}
        \end{subfigure}
-       \caption{Separation of concerns in a traditional setting and in \gls{TOSD} (adapted from~\cite[\citepage{20}]{wang_maintaining_2018}).}%
+       \caption{Separation of concerns in a traditional setting compared to \gls{TOSD} (adapted from~\cite[\citepage{20}]{wang_maintaining_2018}).}%
        \label{fig:tosd}
 \end{figure}
 
 \begin{description}
        \item[\Glsxtrshort{UI} (presentation layer):]
                The \gls{UI} of the system is automatically generated from the representation of the type.
-               Even though the \gls{UI} is generated from the structure of the datatypes, in practical \gls{TOP} systems it can be tweaked afterwards to suit the specific needs of the application.
+               Though, practical \gls{TOP} systems allow tweaking afterwards to suit the specific needs of the application.
        \item[Tasks (business layer):]
                A task is an abstract representation of a piece of work that needs to be done.
                It provides an intuitive abstraction over work in the real world.
-               Just as with real-life tasks and workflow, tasks can be combined in various ways such as in parallel or in sequence.
-               Furthermore, a task is observable which means it is possible to observe a---partial---result during execution and act upon it by for example starting new tasks.
-               Examples of tasks are filling in a form, sending an email, reading a sensor or even doing a physical task.
+               Tasks are observable.
+               During execution, it is possible to observe a---partial---result and act upon it, e.g.\ by starting new tasks
+               Examples of tasks are filling forms, sending emails, reading sensors or even doing physical tasks.
+               Just as with real-life tasks, multiple tasks can be combined in various ways such as in parallel or in sequence to form workflows.
+               Such combination functions are called task combinators.
        \item[\Glsxtrshortpl{SDS} (resource access):]
-               Tasks can communicate using task values, some collaboration require tasks that are not necessarily related need to share data.
-               Hence, tasks can also share data using \glspl{SDS}, an abstraction over any data.
+               Tasks mainly communicate using their observable task values.
+               However, some collaboration require tasks that are not necessarily related need to share data.
+               \Glspl{SDS} fill this gap, they offer a safe and type safe abstraction over any data.
                An \gls{SDS} can represent typed data stored in a file, a chunk of memory, a database \etc.
-               \Glspl{SDS} can also represent external impure data such as the time, random numbers or sensory data.
-               Similar to tasks, transformation and combination of \glspl{SDS} is possible.
+               \Glspl{SDS} can also represent external impure data such as the time, random numbers or sensor data.
+               In many \gls{TOP} langauges, combinators are available to filter, combine, transform, and focus \glspl{SDS}.
        \item[Programming language (\glsxtrshort{UOD}):]
-               The \gls{UOD} from the business layer is explicitly and separately modelled by the relations that exist in the functions of the host language.
+               The \gls{UOD} is explicitly and separately modelled by the relations that exist in the functions of the host language.
 \end{description}
 
-There are two ways of looking at this model when also incorporating edge devices for \gls{IOT} systems.
+Applying the concepts of \gls{LSOC} to \gls{IOT} systems can broadly be done in two ways:
 Firstly, edge devices can be seen as simple resources, thus accessed through the resource access layer.
-Secondly, edge devices are miniature \gls{LSOC} systems in itself as well.
+The second view is that edge devices contain miniature \gls{LSOC} systems in itself as well.
 In \gls{TOSD} the same can be applied.
-The individual components in the miniature systems, the tasks, the \glspl{SDS}, are connected to the other systems.
+The individual components in the miniature systems, the tasks, the \glspl{SDS}, are connected to the main system.
+\todo[inline]{Is deze \P{} duidelijk genoeg?}
 
 \subsection{\texorpdfstring{\Gls{ITASK}}{ITask}}
 The concept of \gls{TOP} originated from the \gls{ITASK} framework, a declarative interactive systems language and \gls{TOP} engine 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}.
 From the structural properties of the data types, the entire user interface is automatically generated.
 
-As an example, \cref{lst:enter_person,fig:enter_person} show the \gls{ITASK} code and the corresponding \gls{UI} for a simple task for entering a person.
+As an example, \cref{lst:enter_person,fig:enter_person} show the \gls{ITASK} code and the corresponding \gls{UI} for a simple task for entering information about a person and viewing the entered result after completion.
 From the data type definitions (\cref{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.
+Using task combinators (e.g.\ \cleaninline{>>!} at \cref{lst:task_comb}), the tasks can be combined in sequence.
+Only when the user enters 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 used to tweak the \gls{UI} so that informative labels are displayed.
 
 \begin{figure}[ht]
        \includegraphics[width=.325\linewidth]{person0g}
@@ -233,7 +239,7 @@ Special combinators (e.g.\ \cleaninline{@>>} at \cref{lst:task_ui}) are availabl
        \label{fig:enter_person}
 \end{figure}
 
-\begin{lstClean}[numbers=left,caption={The \gls{UI} and code for entering a person in \gls{ITASK}.},label={lst:enter_person}]
+\begin{lstClean}[numbers=left,caption={The code for entering a person in \gls{ITASK}.},label={lst:enter_person}]
 :: Person = { name :: String, gender :: Gender, dateOfBirth :: Date }[+\label{lst:dt_fro}+]
 :: Gender = Male | Female | Other String[+\label{lst:dt_to}+]
 
@@ -245,28 +251,30 @@ enterPerson
        >>! \result->Hint "You Entered:"    @>> viewInformation  [] result[+\label{lst:task_comb}+]
 \end{lstClean}
 
-Functional languages are excellent hosts for \gls{TOP} language 
-\Gls{ITASK} is embedded in a functional language
-
 \subsection{\texorpdfstring{\Gls{MTASK}}{MTask}}
+\todo[inline]{Describe problem with iTask for the IoT.}
 This thesis uses \gls{ITASK} in conjunction with \gls{MTASK}, an innovative \gls{TOP} language designed for defining interactive systems for \gls{IOT} edge devices \citep{koopman_task-based_2018}.
-Where \gls{ITASK} abstracts away from details such as user interfaces, data storage, client-side platforms, and persistent workflows.
-On the other hand, \gls{MTASK} offers abstractions for edge layer-specific details such as the heterogeneity of architectures, platforms and frameworks; peripheral access; (multi) task scheduling; and lowering energy consumption.
-The \gls{MTASK} language is written in \gls{CLEAN} as a multi-view \gls{EDSL} and hence there are multiple interpretations of the language of which the byte code compiler is the most relevant for this thesis.
-From \gls{MTASK} term constructed at runtime, a very compact binary representation of the work that needs to be done is compiled.
-This byte code is then sent to a device that running the \gls{MTASK} \gls{RTS}, a domain-specific \gls{TOP} engine implemented as a feather-light domain-specific \gls{OS}.
+\Gls{ITASK} abstracts away from details such as user interfaces, data storage, client-side platforms, and persistent workflows.
+On the other hand, \gls{MTASK} offers abstractions for edge layer-specific details such as the heterogeneity of architectures, platforms, and frameworks; peripheral access; (multi) task scheduling; and lowering energy consumption.
+The \gls{MTASK} language is written in \gls{CLEAN} as a multi-view \gls{EDSL} and hence there are multiple interpretations possible.
+The byte code compiler is the most relevant for this thesis.
+From an \gls{MTASK} task constructed at runtime, a compact binary representation of the work that needs to be done is compiled.
+This byte code is then sent to a device that running the \gls{MTASK} \gls{RTS}.
+This feather-light domain-specific \gls{OS} is written in portable \gls{C} with a minimal device specific interface and functions as a \gls{TOP} engine.
 \Gls{MTASK} is seamlessly integrated with \gls{ITASK}: \gls{MTASK} tasks are integrated in such a way that they function as \gls{ITASK} tasks, and \glspl{SDS} in on the device can tether an \gls{ITASK} \gls{SDS}.
-Using \gls{MTASK}, the programmer defines all layers of an \gls{IOT} system as a single declarative specification.
+Using \gls{MTASK}, the programmer can define all layers of an \gls{IOT} system as a single declarative specification.
 
 \todo[inline]{Is this example useful? I think it's too technical}
 \Cref{lst:intro_blink} shows an interactive \gls{MTASK}\slash{}\gls{ITASK} application for blinking \pgls{LED} on the microcontroller every user-specified interval.
 \Crefrange{lst:intro:itask_fro}{lst:intro:itask_to} show the \gls{ITASK} part.
-First a \gls{SDS} is defined to communicate the blinking interval, then the \gls{MTASK} is connected using \cleaninline{withDevice}.
-Once connected, the \cleaninline{intBlink} task is sent to the device (\cref{lst:intro_liftmtask}) and in parallel, the value of the interval \gls{SDS} can be updated using an editor (\cref{lst:intro_editor}).
-The \cleaninline{intBlink} task (\crefrange{lst:intro:mtask_fro}{lst:intro:mtask_to}) is the \gls{MTASK} part of the application that has its own tasks, \glspl{SDS}, and \gls{UOD}.
-This task first defines \gls{GPIO} pin 13 to be of the output type (\cref{lst:intro:declarePin}) followed by lifting the \gls{ITASK} \gls{SDS} to an \gls{MTASK} \gls{SDS} (\cref{lst:intro:liftsds}).
-The main expression of the program calls the \cleaninline{blink} function with the initial state.
+First \pgls{SDS} is defined to communicate the blinking interval, then the \gls{MTASK} is connected using \cleaninline{withDevice}.
+Once connected, the \cleaninline{intBlink} task is sent to the device (\cref{lst:intro_liftmtask}) and, in parallel, an editor is shown that updates the value of the interval \gls{SDS} (\cref{lst:intro_editor}).
+The \cleaninline{intBlink} task (\crefrange{lst:intro:mtask_fro}{lst:intro:mtask_to}) is the \gls{MTASK} part of the application.
+It has its own tasks, \glspl{SDS}, and \gls{UOD}.
+This task first defines \gls{GPIO} pin 13 to be of the output type (\cref{lst:intro:declarePin}), followed by lifting the \gls{ITASK} \gls{SDS} to an \gls{MTASK} \gls{SDS} (\cref{lst:intro:liftsds}).
+The main expression of the program calls the \cleaninline{blink} function with an initial state.
 This function on \crefrange{lst:intro:blink_fro}{lst:intro:blink_to} first reads the interval \gls{SDS}, waits the specified delay, writes the state to the \gls{GPIO} pin and calls itself recursively using the inverse of the state.
+\todo[inline]{conclude}
 
 \begin{lstClean}[numbers=left,caption={\Gls{MTASK}\slash{}\gls{ITASK} interactive blinking.},label={lst:intro_blink}]
 interactiveBlink :: Task Int[+\label{lst:intro:itask_fro}+]
index 06298c0..7e488d1 100644 (file)
@@ -4,10 +4,10 @@
 \begin{tikzpicture}[node distance=3em,nodes={rectangle,draw,minimum width=12em}]
 %      \node (0) [dotted] {Business layer};
 %      \node (1) [below=of 0] {Presentation layer};
-       \node (1) [] {Presentation layer};
-       \node (2) [below=of 1] {Application layer};
+       \node (1) [] {Presentation};
+       \node (2) [below=of 1] {Application};
 %      \node (3) [below=of 2] {Network layer};
-       \node (3) [below=of 2] {Perception layer};
+       \node (3) [below=of 2] {Perception};
 
        \draw [<->] (1) -- (2);
        \draw [<->] (2) -- (3);
@@ -18,7 +18,7 @@
                -- ([yshift=-1em,xshift=1em]1.south east)
                -- ([xshift=1em]1.north east)
                -- ([xshift=3em]1.north east)
-               -- node [draw=none,midway,sloped,below,yshift=-2pt] {Network layer} ([xshift=3em]3.south east)
+               -- node [draw=none,midway,sloped,below,yshift=-2pt] {Network} ([xshift=3em]3.south east)
                -- ([xshift=1em]3.south east)
                -- ([yshift=1em,xshift=1em]3.north east)
                -- ([xshift=1em,yshift=1em]3.north west)
index 3fbee44..64b332d 100644 (file)
@@ -13,7 +13,7 @@
                25/\textcolor{black}{UI},
                25/\textcolor{black}{Tasks},
                25/\textcolor{white}{UoD},
-               25/\textcolor{white}{SDS}
+               25/\textcolor{white}{SDSs}
        }
        \node [draw,fill=white,circle]{Types};
 \end{tikzpicture}
index 39f678b..8c6404c 100644 (file)
@@ -2,9 +2,9 @@
 \usetikzlibrary{positioning}
 \begin{document}
 \begin{tikzpicture}[node distance=1em,nodes={rectangle,draw,minimum width=10em,minimum height=2.5em}]
-       \node (0) [fill=black!20,text=black]            {Presentation layer};
-       \node (1) [fill=black!40,text=black,below=of 0] {Business layer};
-       \node (2) [fill=black!80,text=white,below=of 1] {Resource access layer};
+       \node (0) [fill=black!20,text=black]            {Presentation};
+       \node (1) [fill=black!40,text=black,below=of 0] {Business};
+       \node (2) [fill=black!80,text=white,below=of 1] {Resource access};
 
        \draw [<->] (0) -- (1);
        \draw [<->] (1) -- (2);