kill all orphans and widows
[phd-thesis.git] / tvt / tvt.tex
index 2b5ac47..e541a06 100644 (file)
@@ -36,7 +36,7 @@ Conventional \gls{IOT} software architectures require the development of separat
        \item The developer must deal with the potentially diverse failure modes of each component, and of component interoperation.
 \end{enumerate*}
 
-A radical alternative development paradigm uses a single \emph{tierless} language that synthesizes all components\slash{}tiers in the software stack. There are established \emph{tierless} languages for web stacks, e.g.\ Links \citep{cooper2006links} or Hop \citep{serrano2006hop}.
+A radical alternative development paradigm uses a single \emph{tierless} language that synthesises all components\slash{}tiers in the software stack. There are established \emph{tierless} languages for web stacks, e.g.\ Links \citep{cooper2006links} or Hop \citep{serrano2006hop}.
 In a tierless language the developer writes the application as a single program. The code for different tiers is simultaneously checked by the compiler, and compiled to the required component languages. For example, Links compiles to HTML and JavaScript for the web client and to SQL on the server to interact with the database system. Tierless languages for \gls{IOT} stacks are more recent and less common, examples include
 Potato \citep{troyer_building_2018} and \gls{CLEAN} with \imtask{} \citep{lubbers_interpreting_2019}.
 
@@ -520,6 +520,7 @@ While this simple application makes limited use of the \gls{MTASK} \gls{EDSL}, i
 Function composition (\cref{lst_t4t:mtasktemp:o}) and currying (\cref{lst_t4t:mtasktemp:setSds}) are inherited from the \gls{CLEAN} host language.
 As \gls{MTASK} tasks are dynamically compiled, it is also possible to select and customise tasks as required at runtime.
 For example, the interval used in the \cleaninline{rpeatevery} task (\cref{lst_t4t:mtasktemp:rpeatevery}) could be a parameter to the \cleaninline{devTask} function.
+\newpage%
 
 \begin{lstClean}[%
        numbers=left,
@@ -555,7 +556,7 @@ devTask =
 
 mainTask :: Task Real
 mainTask
-       =   withDevice deviceInfo \dev -> liftmTask} devTask dev[+\label{lst_t4t:mtasktemp:liftmtask}+][+\label{lst_t4t:mtasktemp:withdevice}+][+\label{lst_t4t:mtasktemp:co2}\srcmark{CO}+]
+       =   withDevice deviceInfo \dev -> liftmTask devTask dev[+\label{lst_t4t:mtasktemp:liftmtask}+][+\label{lst_t4t:mtasktemp:withdevice}+][+\label{lst_t4t:mtasktemp:co2}\srcmark{CO}+]
        -|| viewSharedInformation [] latestTemp[+\label{lst_t4t:mtasktemp:wi1}\srcmark{WI}+]
        <<@ Title "Latest temperature"[+\label{lst_t4t:mtasktemp:wi2}\srcmark{WI}+]
 \end{lstClean}
@@ -687,11 +688,10 @@ Observation of the four implementations shows that they operate as expected, e.g
 All four implementations use an identical set of inexpensive sensors, so we expect the accuracy of the data collected is within tolerance levels. This is validated by comparing \gls{PRS} and \gls{PWS} sensor nodes deployed in the same room for some minutes. The measurements show only small variances, e.g.\ temperatures recorded differ by less than \qty{0.4}{\celcius}, and light by less than \qty{1}{lux}. For this room monitoring application precise timings are not critical, and we don't compare the timing behaviours of the implementations.
 
 \subsubsection{Memory and power consumption}%
-%\subsubsection{Memory Consumption}%
 \label{sec_t4t:MemPower}
 
 \paragraph{Memory} By design sensor nodes are devices with limited computational capacity, and memory is a key restriction. Even supersensors often have less than a \unit{\gibi\byte} of memory, and microcontrollers often have just tens of \unit{\kibi\byte}.
-As the tierless languages synthesize the code to be executed on the sensor nodes, we need to confirm that the generated code is sufficiently memory efficient.
+As the tierless languages synthesise the code to be executed on the sensor nodes, we need to confirm that the generated code is sufficiently memory efficient.
 
 \begin{table}
        \centering
@@ -844,14 +844,14 @@ A caveat is that the smart campus system is relatively simple, and developing mo
                \midrule
                Code Location & Functionality & \gls{PYTHON} & \gls{CLEAN}\\
                \midrule
-               Sensor Node   & Sensor Int.   & imperative   & declarative\\
-                             & Sensor Node   & imperative   & declarative\\
+               Sensor Node   & Sensor Interface   & Imperative   & Declarative\\
+                             & Sensor Node   & Imperative   & Declarative\\
                \midrule
-               Server        & Manage Nodes  & imperative   & declarative\\
-                             & Web Int.      & both         & declarative\\
-                             & Database Int. & both         & declarative\\
+               Server        & Manage Nodes  & Imperative   & Declarative\\
+                             & Web Interface      & Both         & Declarative\\
+                             & Database Interface & Both         & Declarative\\
                \midrule
-               Communication & Communication & imperative   & declarative\\
+               Communication & Communication & Imperative   & Declarative\\
                \midrule
                              & Total         & 2            & 1 \\
                \bottomrule
@@ -867,7 +867,6 @@ Interoperation \emph{increases the cognitive load on the developer} who must sim
 The developer must \emph{correctly interoperate the components}, e.g.\ adhere to the \gls{API} or communication protocols between components. The interoperation often entails additional programming tasks like marshalling or unmarshalling data between components. For example, in the tiered \gls{PRS} and \gls{PWS} architectures, \gls{JSON} is used to serialise and deserialise data strings from the \gls{PYTHON} collector component before storing the data in the Redis database (\cref{lst_t4t:json}).
 
 \begin{lstPython}[caption={\Gls{JSON} Data marshalling in \gls{PRS} and \gls{PWS}: sensor node above, server below.},label={lst_t4t:json}]
-
 channel = 'sensor_status.%s.%s' % (hostname,
        sensor_types.sensor_type_name(s.sensor_type))
                self.r.publish(channel, s.SerializeToString())
@@ -920,7 +919,7 @@ The exchange of data, user interface, and communication are all automatically ge
 
 Another reason that the tierless \gls{CLEAN} implementations are concise is because they use powerful higher order \gls{IOT} programming abstractions.
 For comprehensibility the simple temperature sensor from \cref{sec_t4t:mtasks} (\cref{lst_t4t:mtasktemp}) is used to compare the expressive power of \gls{CLEAN} and \gls{PYTHON}-based \gls{IOT} programming abstractions.
-There are implementations for all four configurations: \gls{PRTS} (\gls{PYTHON} Raspberry Pi Temperature Sensor)\footnotemark, \gls{PWTS}\footnotemark[\value{footnote}],
+There are implementations for all four configurations: \gls{PRTS}\footnotemark, \gls{PWTS}\footnotemark[\value{footnote}],
 \footnotetext{Lubbers, M.; Koopman, P.; Ramsingh, A.; Singer, J.; Trinder, P. (2021): Source code, line counts and memory stats for PRS, PWS, PRT and PWT.\ Zenodo.\ \href{https://doi.org/10.5281/zenodo.5081386}{10.5281/zenodo.5081386}.} \gls{CRTS}\footnotemark{} and \gls{CWTS}\footnotemark[\value{footnote}].
 \footnotetext{Lubbers, M.; Koopman, P.; Ramsingh, A.; Singer, J.; Trinder, P. (2021): Source code, line counts and memory stats for CRS, CWS, CRTS and CWTS.\ Zenodo.\ \href{https://doi.org/10.5281/zenodo.5040754}{10.5281/zenodo.5040754}.}
 but as the programming abstractions are broadly similar, we compare only the \gls{PWTS} and \gls{CWTS} implementations.
@@ -1009,7 +1008,7 @@ failover :: [TCPSettings] (Main (MTask BCInterpret a)) -> Task a
 failover []     _     = throw "Exhausted device pool"
 failover [d:ds] mtask = try (withDevice d (liftmTask mtask)) except
 where except MTEUnexpectedDisconnect = failover ds mtask
-         except _                       = throw e
+         except e                       = throw e
 \end{lstClean}
 
 In the \gls{UOG} smart campus application, this can be done by creating a pool of sensor nodes for each room and when a sensor node fails, assign another one to the task.
@@ -1042,6 +1041,7 @@ In summary, while a tiered approach makes replacing components easy, refactoring
 \label{sec_t4t:support}
 Community and tool support are essential for engineering reliable production software. \Gls{PRS} and \gls{PWS} are both \gls{PYTHON} based, and \gls{PYTHON}\slash\gls{MICROPYTHON} are among the most popular programming languages \citep{cass2020top}. \Gls{PYTHON} is also a common choice for some tiers of \gls{IOT} applications \citep{tanganelli2015coapthon}.
 Hence, there are a wide range of development tools like \glspl{IDE} and debuggers, a thriving community and a wealth of training material. There are even specialised \gls{IOT} Boards like PyBoard \& WiPy that are specifically programmed using \gls{PYTHON} variations like \gls{MICROPYTHON}.
+\pagebreak
 
 In contrast, tierless languages are far less mature than the languages used in tiered stacks, and far less widely adopted.
 This means that for \gls{CWS} and \gls{CRS} there are fewer tools, a far smaller developer community, and less training material available.
@@ -1064,7 +1064,7 @@ This section compares the \gls{ITASK} and \gls{MTASK} \glspl{EDSL}, with referen
 
 \begin{table}
        \small
-       \caption{Comparing tierless \gls{IOT} languages for resource-rich sensor nodes (\gls{ITASK} \gls{EDSL}), for resource-constrained sensor nodes (\gls{MTASK} \gls{EDSL}), and their \gls{CLEAN} host language.}%
+       \caption{Comparing tierless \gls{IOT} \glspl{DSL} for resource-rich sensor nodes (\gls{ITASK}), for resource-constrained sensor nodes (\gls{MTASK}), and their \gls{CLEAN} host language.}%
        \label{table_t4t:languagecomparison}
        \begin{tabular}{llll}
                \toprule
@@ -1079,10 +1079,10 @@ This section compares the \gls{ITASK} and \gls{MTASK} \glspl{EDSL}, with referen
                User-defined datatypes      & Yes    & Yes         & No \\
                Task oriented               & No     & Yes         & Yes \\
                Higher-order tasks          & {--}   & Yes         & No \\
-               Execution Target & Commodity PC & Commodity PC & microcontroller\\
-                                &              & and Browser & microcontroller\\
+               Execution Target & Commodity PC & Commodity PC & Microcontroller\\
+                                &              & and browser & Microcontroller\\
                Language Implementation & Compiled or & Compiled and & Interpreted\\
-                                       & interpreted & interpreted & Interpreted\\
+                                       & interpreted & interpreted & \\
                \bottomrule
        \end{tabular}
 \end{table}