From: Mart Lubbers Date: Wed, 5 Jul 2017 14:17:45 +0000 (+0200) Subject: compartimentalize presentation, elaborate X-Git-Tag: final~35 X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=26060876e5fffdeff52db1abe6e8ffc4619d3fd8;p=msc-thesis1617.git compartimentalize presentation, elaborate --- diff --git a/pres.intro.tex b/pres.intro.tex new file mode 100644 index 0000000..428d1fe --- /dev/null +++ b/pres.intro.tex @@ -0,0 +1,190 @@ +\subsection{IoT} +\begin{frame} + \frametitle{Internet of Things (IoT)} + \begin{itemize}[<+->] + \item Early days, RFID + \item Devices: Arduino, ESP8266, Raspberry pi\ldots + \item Peripherals: GPS, Sensors, Actuators\ldots + \item Wearables: Smart clothing, smart watches\ldots + \item Connectivity: LoRa (Sigfox, KPN, TTN), BTLE, WiFi, ZigBee\ldots + \item \ldots + \end{itemize} +\end{frame} + +\subsection{iTasks} +\begin{frame}[fragile] + \frametitle{Task Oriented Programming} + \framesubtitle{\ldots and iTasks} + \begin{block}{iTasks} + \begin{itemize}[<+->] + \item Basic blocks + \item Generated web interface + \item Type driven + \end{itemize} + \end{block} + \pause{} + \begin{columns}[c] + \column{.49\linewidth} + \begin{block}{Tasks} + \begin{itemize}[<+->] + \item Observables + \item Given the state, a \CI{TaskValue} is observed. + \item Continuous execution + \item Generics + \end{itemize} + \end{block} + \pause{} + \column{.49\linewidth} + \begin{figure}[ht] + \centering + \includegraphics[width=\linewidth]{fig-taskvalue} + \caption{The states of a \CI{TaskValue}} + \end{figure} + \end{columns} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Task Oriented Programming} + \framesubtitle{Example} + \begin{lstlisting} +:: Name = { firstname :: String, lastname :: String } +derive class iTask Name + +enterInformation :: String [EnterOption m] -> Task m | iTask m +enterName :: Task Name +enterName = enterInformation "Enter your name" [] + \end{lstlisting} + + \begin{figure}[H] + \centering + \begin{subfigure}{.30\textwidth} + \centering + \includegraphics[width=.9\linewidth]{taskex1} + \caption{Initial interface\\~}\label{fig:taskex1} + \end{subfigure} + \begin{subfigure}{.30\textwidth} + \centering + \includegraphics[width=.9\linewidth]{taskex2} + \caption{Incomplete entrance}\label{fig:taskex2} + \end{subfigure} + \begin{subfigure}{.30\textwidth} + \centering + \includegraphics[width=.9\linewidth]{taskex3} + \caption{Complete entry\\~}\label{fig:taskex3} + \end{subfigure} + \caption{Example of a generated user interface} + \end{figure} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Task Oriented Programming (3)} + \framesubtitle{Combinators} + \begin{block}{Sequence} + \begin{lstlisting} +(>>=) infixl 1 :: (Task a) (a -> Task b) -> Task b | iTask a & iTask b +(>>*) infixl 1 :: (Task a) [TaskCont a (Task b)] -> Task b | iTask a & iTask b +:: TaskCont a b + = OnValue ((TaskValue a) -> Maybe b) + | OnAction Action ((TaskValue a) -> Maybe b) + | E.e: OnException (e -> b) & iTask e + | OnAllExceptions (String -> b) +:: Action = Action String + \end{lstlisting} + \end{block} + + \begin{block}{Parallel} + \begin{lstlisting} +(-||-) infixr 3 :: (Task a) (Task a) -> Task a | iTask a +( ||-) infixr 3 :: (Task a) (Task b) -> Task b | iTask a & iTask b +(-|| ) infixl 3 :: (Task a) (Task b) -> Task a | iTask a & iTask b +(-&&-) infixr 4 :: (Task a) (Task b) -> Task (a,b) | iTask a & iTask b + \end{lstlisting} + \end{block} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Shared Data Sources (SDS)} + \begin{block}{What is an SDS} + \begin{itemize}[<+->] + \item Read function + \item Write function + \end{itemize} + \end{block} + + \begin{lstlisting} +:: RWShared p r w = ... +:: ReadWriteShared r w :== RWShared () r w +:: Shared r :== ReadWriteShared r r + +get :: (ReadWriteShared r w) -> Task r | iTask r +set :: w (ReadWriteShared r w) -> Task w | iTask w +upd :: (r -> w) (ReadWriteShared r w) -> Task w | iTask r & iTask w + +sharedStore :: String a -> Shared a | JSONEncode{|*|}, JSONDecode{|*|} + +wait :: String (r -> Bool) (ReadWriteShared r w) -> Task r + \end{lstlisting} +\end{frame} + +\begin{frame}[fragile] + \frametitle{SDS (2)} + \framesubtitle{Parametric Lenses} + \begin{block}{What is the \CI{p} for in \CI{RWShared p r w}} + \pause{} + \begin{itemize} + \item Parameter fixed when writing + \item Used for notifications + \end{itemize} + \end{block} + + \begin{lstlisting} +sdsFocus :: p1 (RWShared p1 r w) -> RWShared p2 r w | iTask p + +:: SDSNotifyPred p :== p -> Bool +:: SDSLensRead p r rs = SDSRead (p -> rs -> MaybeError TaskException r) + | SDSReadConst (p -> r) +:: SDSLensWrite p w rs ws = SDSWrite (p -> rs -> w -> MaybeError TaskException (Maybe ws)) + | SDSWriteConst (p -> w -> MaybeError TaskException (Maybe ws)) +:: SDSLensNotify p w rs = SDSNotify (p -> rs -> w -> SDSNotifyPred p) + | SDSNotifyConst (p -> w -> SDSNotifyPred p) + +sdsLens :: String (p -> ps) (SDSLensRead p r rs) (SDSLensWrite p w rs ws) + (SDSLensNotify p w rs) (RWShared ps rs ws) -> RWShared p r w | iTask ps + \end{lstlisting} +\end{frame} + +\begin{frame} + \frametitle{Why add IoT devices to iTasks} + \begin{block}{Why?} + \begin{itemize} + \item Execute Tasks + \item Monitoring + \item Hardware + \end{itemize} + \end{block} + + \pause{} + + \begin{block}{Current possibilities} + \begin{itemize} + \item Implement a device as an SDS + \pause{} + \item Tailor made SDS for every task + \item Difficult to get logic in + \pause{} + \item Arjan's Distributed iTasks + \pause{} + \item Requires fast hardware + \pause{} + \end{itemize} + \end{block} +\end{frame} + +\begin{frame} + \frametitle{Solution} + \pause{} + \begin{block}{EDSL to the rescue} + \pause{} + After the break. + \end{block} +\end{frame} diff --git a/pres.mtask.tex b/pres.mtask.tex new file mode 100644 index 0000000..e0732f0 --- /dev/null +++ b/pres.mtask.tex @@ -0,0 +1,61 @@ +\subsection{EDSLs} +\begin{frame} + \frametitle{Embedded Domain Specific Language} + \framesubtitle{What is are EDSL} + \begin{itemize} + \item DSL:\ language for a specific domain + \item E.g., PostScript, VimScript, HTML, \ldots + \pause{} + \item EDSL:\ Embedded DSL + \item Language in a language + \item Use the properties of the host + \item E.g., Ivory, \ldots\pause{} and iTasks + \end{itemize} +\end{frame} + +\begin{frame} + \frametitle{Embedded Domain Specific Language (2)} + \framesubtitle{Embedding techniques} + \begin{block}{Deep} + \end{block} + + \begin{block}{Shallow} + \end{block} + + \begin{block}{Class based shallow} + \end{block} +\end{frame} + +\begin{frame} + \frametitle{Embedded Domain Specific Language (2)} + \framesubtitle{Shallow Embedding} +\end{frame} + +\begin{frame} + \frametitle{Embedded Domain Specific Language (3)} + \framesubtitle{Class Based Shallow Embedding} +\end{frame} + +\subsection{mTask} +\begin{frame} + \frametitle{mTask} + \pause{} + \begin{block}{What is mTask} + \begin{itemize} + \item EDSL + \item Generates C code + \item Arduino + \end{itemize} + \end{block} + + \begin{block}{Considerations} + \begin{itemize} + \item Type safe + \item Embedded in Clean + \item Extendable + \item \ldots\pause{} but\ldots + \item No interaction + \item Compilation + \end{itemize} + \end{block} +\end{frame} diff --git a/pres.system.tex b/pres.system.tex new file mode 100644 index 0000000..659dc4e --- /dev/null +++ b/pres.system.tex @@ -0,0 +1,77 @@ +\subsection{Overview} +\begin{frame} + \frametitle{Solution} + \begin{itemize}[<+->] + \item New backend for mTask + \item Bytecode generation + \item Interpreter on client + \item Server in iTasks + \item Integration with iTasks + \item No taskserver + \end{itemize} +\end{frame} + +\subsection{Extending mTask} +\begin{frame}[fragile] + \frametitle{Adding a View} + \begin{lstlisting} +:: ByteCode a p = BC (RWS () [BC] BCState ()) +:: BCValue = E.e: BCValue e & mTaskType, TC e +:: BCShare = { sdsi :: Int, sdsval :: BCValue, sdsname :: String } +:: BCState = { freshl :: Int, freshs :: Int, sdss :: [BCShare] } + +instance ByteCode arith, boolExpr, ... + \end{lstlisting} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Functionality} + \begin{block}{SDS scope and naming} + \begin{itemize} + \item SDS is lost + \item State per device + \item Tasks are sent and gone + \end{itemize} + \pause{} + \begin{lstlisting} +class namedsds v where + namedsds :: ((v t Upd) -> In (Named t String) (Main (v c s))) + -> (Main (v c s)) | ... +:: Named a b = Named infix 1 a b + \end{lstlisting} + \end{block} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Task scheduling} + \begin{block}{Old} + \begin{itemize} + \item Task server + \item Tasks start other tasks + \end{itemize} + \end{block} + \pause{} + \begin{block}{New} + \begin{itemize} + \item Old system, taskserver, tasks start tasks + \item New system, task+strategy + \pause{} + \begin{itemize} + \item \CI{OnShot} + \item \CI{OnInterval} + \item \CI{OnInterrupt} + \end{itemize} + \pause{} + \item How to handle termination + \end{itemize} + \pause{} + \begin{lstlisting} +class retrn v where + retrn :: v () Expr + \end{lstlisting} + \end{block} +\end{frame} + +\subsection{Devices} +\subsection{Server} +\subsection{Examples} diff --git a/presentation.tex b/presentation.tex index a0b0997..dd2861c 100644 --- a/presentation.tex +++ b/presentation.tex @@ -9,236 +9,13 @@ \end{frame} \section{Introduction} -\subsection{IoT} -\begin{frame} - \frametitle{Internet of Things (IoT)} - \begin{itemize}[<+->] - \item Early days, RFID - \item Devices: Arduino, ESP8266, Raspberry pi\ldots - \item Peripherals: GPS, Sensors, Actuators\ldots - \item Wearables: Smart clothing, smart watches\ldots - \item Connectivity: LoRa (Sigfox, KPN, TTN), BTLE, WiFi, ZigBee\ldots - \item \ldots - \end{itemize} -\end{frame} - -\subsection{iTasks} -\begin{frame}[fragile] - \frametitle{Task Oriented Programming} - \framesubtitle{\ldots and iTasks} - \begin{block}{iTasks} - \begin{itemize}[<+->] - \item Basic blocks - \item Generated web interface - \item Type driven - \end{itemize} - \end{block} - \pause{} - \begin{columns}[c] - \column{.49\linewidth} - \begin{block}{Tasks} - \begin{itemize}[<+->] - \item Observables - \item Given the state, a \CI{TaskValue} is observed. - \item Continuous execution - \item Generics - \end{itemize} - \end{block} - \pause{} - \column{.49\linewidth} - \begin{figure}[ht] - \centering - \includegraphics[width=\linewidth]{fig-taskvalue} - \caption{The states of a \CI{TaskValue}} - \end{figure} - \end{columns} -\end{frame} - -\begin{frame}[fragile] - \frametitle{Task Oriented Programming} - \framesubtitle{Example} - \begin{lstlisting} -:: Name = { firstname :: String, lastname :: String } -derive class iTask Name - -enterInformation :: String [EnterOption m] -> Task m | iTask m -enterName :: Task Name -enterName = enterInformation "Enter your name" [] - \end{lstlisting} - - \begin{figure}[H] - \centering - \begin{subfigure}{.30\textwidth} - \centering - \includegraphics[width=.9\linewidth]{taskex1} - \caption{Initial interface\\~}\label{fig:taskex1} - \end{subfigure} - \begin{subfigure}{.30\textwidth} - \centering - \includegraphics[width=.9\linewidth]{taskex2} - \caption{Incomplete entrance}\label{fig:taskex2} - \end{subfigure} - \begin{subfigure}{.30\textwidth} - \centering - \includegraphics[width=.9\linewidth]{taskex3} - \caption{Complete entry\\~}\label{fig:taskex3} - \end{subfigure} - \caption{Example of a generated user interface} - \end{figure} -\end{frame} - -\begin{frame}[fragile] - \frametitle{Task Oriented Programming (3)} - \framesubtitle{Combinators} - \begin{block}{Sequence} - \begin{lstlisting} -(>>=) infixl 1 :: (Task a) (a -> Task b) -> Task b | iTask a & iTask b -(>>*) infixl 1 :: (Task a) [TaskCont a (Task b)] -> Task b | iTask a & iTask b -:: TaskCont a b - = OnValue ((TaskValue a) -> Maybe b) - | OnAction Action ((TaskValue a) -> Maybe b) - | E.e: OnException (e -> b) & iTask e - | OnAllExceptions (String -> b) -:: Action = Action String - \end{lstlisting} - \end{block} - - \begin{block}{Parallel} - \begin{lstlisting} -(-||-) infixr 3 :: (Task a) (Task a) -> Task a | iTask a -( ||-) infixr 3 :: (Task a) (Task b) -> Task b | iTask a & iTask b -(-|| ) infixl 3 :: (Task a) (Task b) -> Task a | iTask a & iTask b -(-&&-) infixr 4 :: (Task a) (Task b) -> Task (a,b) | iTask a & iTask b - \end{lstlisting} - \end{block} -\end{frame} - -\begin{frame}[fragile] - \frametitle{Shared Data Sources (SDS)} - \begin{block}{What is an SDS} - \begin{itemize}[<+->] - \item Read function - \item Write function - \end{itemize} - \end{block} - - \begin{lstlisting} -:: RWShared p r w = ... -:: ReadWriteShared r w :== RWShared () r w -:: Shared r :== ReadWriteShared r r - -get :: (ReadWriteShared r w) -> Task r | iTask r -set :: w (ReadWriteShared r w) -> Task w | iTask w -upd :: (r -> w) (ReadWriteShared r w) -> Task w | iTask r & iTask w - -sharedStore :: String a -> Shared a | JSONEncode{|*|}, JSONDecode{|*|} - -wait :: String (r -> Bool) (ReadWriteShared r w) -> Task r - \end{lstlisting} -\end{frame} - -\begin{frame}[fragile] - \frametitle{SDS (2)} - \framesubtitle{Parametric Lenses} - \begin{block}{What is the \CI{p} for in \CI{RWShared p r w}} - \pause{} - \begin{itemize} - \item Parameter fixed when writing - \item Used for notifications - \end{itemize} - \end{block} - - \begin{lstlisting} -sdsFocus :: p1 (RWShared p1 r w) -> RWShared p2 r w | iTask p - -:: SDSNotifyPred p :== p -> Bool -:: SDSLensRead p r rs = SDSRead (p -> rs -> MaybeError TaskException r) - | SDSReadConst (p -> r) -:: SDSLensWrite p w rs ws = SDSWrite (p -> rs -> w -> MaybeError TaskException (Maybe ws)) - | SDSWriteConst (p -> w -> MaybeError TaskException (Maybe ws)) -:: SDSLensNotify p w rs = SDSNotify (p -> rs -> w -> SDSNotifyPred p) - | SDSNotifyConst (p -> w -> SDSNotifyPred p) - -sdsLens :: String (p -> ps) (SDSLensRead p r rs) (SDSLensWrite p w rs ws) - (SDSLensNotify p w rs) (RWShared ps rs ws) -> RWShared p r w | iTask ps - \end{lstlisting} -\end{frame} - -\begin{frame} - \frametitle{Why add IoT devices to iTasks} - \begin{block}{Why?} - \begin{itemize} - \item Execute Tasks - \item Monitoring - \item Hardware - \end{itemize} - \end{block} - - \pause{} - - \begin{block}{Current possibilities} - \begin{itemize} - \item Arjan's Distributed iTasks - \item Implement a device as an SDS - \pause{} - \item Difficult to get logic in - \end{itemize} - \end{block} -\end{frame} +\input{pres.intro} \section{mTask} -\subsection{EDSLs} -\begin{frame} - \frametitle{Embedded Domain Specific Language} - \framesubtitle{What is are EDSL} - \begin{itemize} - \item DSL:\ language for a specific domain - \item E.g., PostScript, VimScript, HTML, \ldots - \pause{} - \item EDSL:\ Embedded DSL - \item Language in a language - \item Use the properties of the host - \item E.g., Ivory, \ldots\pause{} and iTasks - \end{itemize} -\end{frame} - -\begin{frame} - \frametitle{Embedded Domain Specific Language (2)} - \framesubtitle{Embedding techniques} - \begin{block}{Deep} - \end{block} - - \begin{block}{Shallow} - \end{block} - - \begin{block}{Class based shallow} - \end{block} -\end{frame} - -\begin{frame} - \frametitle{Embedded Domain Specific Language (2)} - \framesubtitle{Shallow Embedding} -\end{frame} - -\begin{frame} - \frametitle{Embedded Domain Specific Language (3)} - \framesubtitle{Class Based Shallow Embedding} -\end{frame} - -\subsection{mTask} -\begin{frame} - \frametitle{mTask} - \framesubtitle{Class Based Shallow Embedding} -\end{frame} - -\begin{frame} - \frametitle{Extending mTask} -\end{frame} +\input{pres.mtask} \section{System Overview} -\subsection{Devices} -\subsection{Server} -\subsection{Examples} +\input{pres.system} \section{Demo} \begin{frame} @@ -247,4 +24,5 @@ sdsLens :: String (p -> ps) (SDSLensRead p r rs) (SDSLensWrite p w rs ws) \begin{frame} \frametitle{And ofcourse\ldots a demo} \end{frame} + \end{document}