Task Oriented Programming in using Rinus Plasmeijer – Bas Lijnse - Peter Achten Pieter Koopman - Steffen Michels – Jurriën Stutterheim Jan Martin Jansen.

Slides:



Advertisements
Similar presentations
More about Ruby Maciej Mensfeld Presented by: Maciej Mensfeld More about Ruby dev.mensfeld.pl github.com/mensfeld.
Advertisements

Microsoft Research March 20, 2000 A Programming Language for Developing Interactive Web Services Claus Brabrand BRICS, University of Aarhus, Denmark.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Java Script Session1 INTRODUCTION.
Apache Struts Technology
1 Mooly Sagiv and Greta Yorsh School of Computer Science Tel-Aviv University Modern Compiler Design.
Task Oriented Programming in using Rinus Plasmeijer – Bas Lijnse - Peter Achten Pieter Koopman - Steffen Michels - Jurriën Stutterheim Jan Martin Jansen.
Exceptions, Templates, And The Standard Template Library (STL) Chapter 16.
Copyright © 2012 Pearson Education, Inc. Chapter 16: Exceptions, Templates, and the Standard Template Library (STL)
Lecture 1 Introduction to the ABAP Workbench
Task Oriented Programming in using Rinus Plasmeijer – Bas Lijnse - Peter Achten Pieter Koopman - Steffen Michels - Jurriën Stutterheim Jan Martin Jansen.
FP-dag Pimp my workflow system A tool preview of iTasks 2.0 Bas Lijnse.
Rinus Plasmeijer – Jan Martin Jansen - Peter Achten – Pieter Koopman University of Nijmegen - Dutch Defense Academy clean.cs.ru.nlhttp://
COMP205 Comparative Programming Languages Part 1: Introduction to programming languages Lecture 3: Managing and reducing complexity, program processing.
IFL2002 Madrid 1 a generic test-system Pieter Koopman, Artem Alimarine, Jan Tretmans, Rinus Plasmeijer Nijmegen, NL.
Sparkle A theorem prover for the functional language Clean Maarten de Mol University of Nijmegen February 2002.
February 12, 2009 Center for Hybrid and Embedded Software Systems Model Transformation Using ERG Controller Thomas H. Feng.
The Composite Pattern.. Composite Pattern Intent –Compose objects into tree structures to represent part-whole hierarchies. –Composite lets clients treat.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Course Instructor: Aisha Azeem
C++ fundamentals.
1 Exception and Event Handling (Based on:Concepts of Programming Languages, 8 th edition, by Robert W. Sebesta, 2007)
Introduction To System Analysis and design
ADLB Update Recent and Current Adventures with the Asynchronous Dynamic Load Balancing Library Rusty Lusk Mathematics and Computer Science Division Argonne.
INTRODUCTION TO WEB DATABASE PROGRAMMING
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
A Scalable Application Architecture for composing News Portals on the Internet Serpil TOK, Zeki BAYRAM. Eastern MediterraneanUniversity Famagusta Famagusta.
Task Oriented Programming in using Rinus Plasmeijer – Bas Lijnse - Peter Achten Pieter Koopman - Steffen Michels - Jurriën Stutterheim Jan Martin Jansen.
Microsoft Visual Basic 2005: Reloaded Second Edition
Introduction to Object-oriented programming and software development Lecture 1.
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
Developing Workflows with SharePoint Designer David Coe Application Development Consultant Microsoft Corporation.
Java: Chapter 1 Computer Systems Computer Programming II.
Copyright © 2007, Oracle. All rights reserved. Managing Concurrent Requests.
Chapter 1 - Introduction
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
The Java Programming Language
Programming Language C++ Xulong Peng CSC415 Programming Languages.
Ajax and Client-Side Evaluation of i-Tasks Workflow Specifications Rinus Plasmeijer – Jan Martin Jansen - Peter Achten – Pieter Koopman University of Nijmegen.
Task Oriented Programming in using Rinus Plasmeijer – Bas Lijnse - Peter Achten Pieter Koopman - Steffen Michels - Jurriën Stutterheim Jan Martin Jansen.
TOP Rinus Plasmeijer – Bas Lijnse - Peter Achten Pieter Koopman - Steffen Michels - Jurrien Slutterheim (TNO-RU) Jan Martin Jansen (NLDA) - Laszlo Domoszlai.
Chapter 10 Analysis and Design Discipline. 2 Purpose The purpose is to translate the requirements into a specification that describes how to implement.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 3, Lecture 1.
Types in programming languages1 What are types, and why do we need them?
11 CORE Architecture Mauro Bruno, Monica Scannapieco, Carlo Vaccari, Giulia Vaste Antonino Virgillito, Diego Zardetto (Istat)
1 Alex Proctor and Brian Lee for CSCI 431 at UNCA, Fall 2002 ML (Meta Language) a brief introduction Alex Proctor and Brian Lee For CSCI 431 at the University.
1.
UI's for inputting and presenting the metadata of hypermedia documents Kai Kuikkaniemi HUT T
Software Reuse Course: # The Johns-Hopkins University Montgomery County Campus Fall 2000 Session 4 Lecture # 3 - September 28, 2004.
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
Overview of Previous Lesson(s) Over View  ASP is a technology that enables scripts in web pages to be executed by an Internet server.  ASP.NET is a.
Chapter – 8 Software Tools.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
C language + The Preprocessor. + Introduction The preprocessor is a program that processes that source code before it passes through the compiler. It.
Copyright 2006 Addison-Wesley Brief Version of Starting Out with C++ Chapter 5 Looping.
CS5205Semantics1 CS5205: Foundation in Programming Languages Semantics Static Semantics Dynamic Semantics Operational Semantics Big-step Small-Step Denotational.
© Peter Andreae Java Programs COMP 102 # T1 Peter Andreae Computer Science Victoria University of Wellington.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Architecture Review 10/11/2004
Applications Active Web Documents Active Web Documents.
Text by: Lambert and Osborne
PHP / MySQL Introduction
CMPE419 Mobile Application Development
Introduction to System Programming
Programming Languages 2nd edition Tucker and Noonan
Analysis models and design models
Serpil TOK, Zeki BAYRAM. Eastern MediterraneanUniversity Famagusta
Combining Compile-Time and Run-Time Components
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Presentation transcript:

Task Oriented Programming in using Rinus Plasmeijer – Bas Lijnse - Peter Achten Pieter Koopman - Steffen Michels – Jurriën Stutterheim Jan Martin Jansen (NLDA) - Laszlo Domoszlai (ELTE) Part 2/2 Radboud University Nijmegen 1

2 Overview  Introduction to Task Oriented Programming  iTask Library  Task Values  Editors  Shared Data  Sequential Tasks  Parallel Tasks  Semantics  Conclusions and Future Work

3 Embedded Domain Specific Language iTask Core Basic tasks Interactive Tasks : Editors Non-interactive Tasks: Lifting & Conversion Integrated Tasks: web-service-call, OS-call, exec application, access a database Combinators for combining tasks Define control flow (sequential / parallel) and data flow between tasks + iTask Library to support frequently occurring work patterns + Clean: general purpose pure functional programming language Recursive -, higher order -, polymorphic -, overloaded -, generic - functions Hybrid typing: strongly statically typed + dynamic typing

Core Concepts Data Local data: Task Values Shared data:Shared Data Sources Tasks Basic Tasks Non-interactive return, throw, … Interactive Editors Combinators Sequential Parallel 4

Core - Task Values :: Task a typed unit of work which should deliver a value of type a While the task is going on, its value may change over time :: TaskResult a= ValRes TimeStamp (Value a) |  e: ExcRes e & iTask e :: Value a = NoVal | Val a Stability :: Stability = Unstable | Stable 5

6 Interactive Editors (see InteractionTasks.dcl) Basic tasks: Interactive editor for filling in forms of a certain type: viewInformation :: d [ViewOption a] a  Task a | descr d & iTask a enterInformation :: d [EnterOption a]  Task a | descr d & iTask a updateInformation :: d [UpdateOption a a] a  Task a | descr d & iTask a enterChoice :: d [ChoiceOption o] [o]  Task o | descr d & iTask o updateChoice :: d [ChoiceOption o] [o] o  Task o | descr d & iTask o enterMultipleChoice :: d [MultiChoiceOption o] [o]  Task [o]| descr d & iTask o updateMultipleChoice :: d [MultiChoiceOption o] [o] [o]  Task [o] | descr d & iTask o

7 Overview  Introduction to Task Oriented Programming  iTask Library  Task Values  Editors  Shared Data  Sequential Tasks  Parallel Tasks  Semantics  Conclusions and Future Work

Core - Shared Data Sources SDS: one abstraction layer for any type of shared data: easy to use for the progammer - Shared Memory, Files, Cloud, Time, Sensors, …. - Reading and Writing can be of different type - SDS’s can be composed from others (e.g. lenses a la Benjamin Pierce) :: RWShared r w :: Shared a :== RWShared a a :: ReadOnlyShared a:== RWShared a Void :: WriteOnlyShared a:== RWShared Void a 8

Shared Data Sources Creating an SDS: withShared :: a ((Shared a) → Task b) → Task b | iTask b// Shared memory sharedStore :: String a → Shared a | iTask a// Special File externalFile :: FilePath → Shared String // Ordinary File sqlShare :: SQLDatabase String … → ReadWriteShared r w // SQL Database Reading an SDS: get :: (RWShared r w) → Task r | iTask r// read once currentTime:: ReadOnlyShared Time currentDate:: ReadOnlyShared Date currentDateTime:: ReadOnlyShared DateTime currentUser:: ReadOnlyShared User users:: ReadOnlyShared [User] Updating an SDS: set :: w (RWShared r w) → Task w | iTask w // write once update :: (r → w) (RWShared r w) → Task w | iTask r & iTask w 9

10 Interactive Editors on SDS’s viewSharedInformation :: d [ViewOption r] (RWShared r w)  Task r | descr d & iTask r updateSharedInformation:: d [UpdateOption r w] (RWShared r w)  Task w | descr d & iTask r & iTask w enterSharedChoice :: d [ChoiceOption o] (RWShared [o] w)  Task o | descr d & iTask o & iTask w updateSharedChoice :: d [ChoiceOption o] (RWShared [o] w) o  Task o | descr d & iTask o & iTask w enterSharedMultipleChoice :: d [MultiChoiceOption o] (RWShared [o] w)  Task [o] | descr d & iTask o & iTask w updateSharedMultipleChoice :: d [MultiChoiceOption o] (RWShared [o] w) [o]  Task [o] | descr d & iTask o & iTask w

Editors on SDS’s viewCurDateTime :: Task DateTime viewCurDateTime = viewSharedInformation "The current date and time is:" [] currentDateTime

Editors on SDS’s twoTasks :: a → Task a | iTask a twoTasks v = withShared vdoTasks doTasks :: (Shared a) → Task a | iTask a doTasks sv = updateSharedInformation sv -|| viewSharedInformation sv 12 Assign task to someone do both tasks in parallel, return first

Core - Basic Tasks : One editor for all cases Basic Tasks / Editor edit :: d l (ROShared r) (r → (l,v)) (l r v → (l,v)) → Task l | descr d & iTask l & iTask r & iTask v -One editor for handling all editor variants in the iTasks API -An editable view v is created given the local value l and shared value r -The view v is updated when v is edited or someone changes r -An editor task never delivers a stable value (it is either NoVal or Val l Unstable) -Tasks do not terminate, but are discarded if they are not needed anymore 13

14 Overview  Introduction to Task Oriented Programming  iTask Library  Task Values  Editors  Shared Data  Sequential Tasks  Parallel Tasks  Semantics  Conclusions and Future Work

15 Sequential Combinator: >>* palindrome :: Task (Maybe String) palindrome = enterInformation "Enter a palindrome" [] >>* [ OnAction ActionOk (ifValue isPalindrome (\v  return (Just v))), OnAction ActionCancel (always (return Nothing)) ]

16 Sequential Combinator: >>* >>* Observe Task a, continue with one of the Task b's: - if a certain action is performed by the end-user - if the value of the observed task is satisfying a certain predicate - or the observed task has raised an exception to be handled here Task a Task b

Core – Sequential Combinator Combinator for Sequential Composition (>>*) infixl 1 :: (Task a) [TaskStep a b] → Task b | iTask a & iTask b :: TaskStep a b = OnAction Action(Value a → Maybe (Task b)) | OnValue (Value a → Maybe (Task b)) | E.e: OnException (e → Task b) & iTask e :: Action= Action String [ActionOption] :: ActionOption= ActionKey Hotkey | ActionWeight Int | ActionIcon String | ActionTrigger DoubleClick :: Hotkey = { key :: Key, ctrl :: Bool, alt :: Bool, shift :: Bool } ActionOk :== Action "Ok“ [ActionIcon "ok", ActionKey (unmodified KEY_ENTER)] 17

Core – Sequential Combinator Combinator for Sequential Composition (>>*) infixl 1 :: (Task a) [TaskStep a b] → Task b | iTask a & iTask b :: TaskStep a b = OnAction Action(Value a → Maybe (Task b)) | OnValue (Value a → Maybe (Task b)) | E.e: OnException (e → Task b) & iTask e :: Action= Action String [ActionOption] :: ActionOption= ActionKey Hotkey | ActionWeight Int | ActionIcon String | ActionTrigger DoubleClick :: Hotkey = { key :: Key, ctrl :: Bool, alt :: Bool, shift :: Bool } ActionOpen:== Action "/File/Open" [ActionIcon "open", ActionKey (ctrl KEY_O)] 18

Core – Sequential Combinator Combinator for Sequential Composition (>>*) infixl 1 :: (Task a) [TaskStep a b] → Task b | iTask a & iTask b :: TaskStep a b = OnAction Action(Value a → Maybe (Task b)) | OnValue (Value a → Maybe (Task b)) | E.e: OnException (e → Task b) & iTask e always task= const (Just task) ifValue pred task (Value v _) = if (pred v) (Just (task v)) Nothing ifValue _ _ _ = Nothing hasValue task (Value v _) = Just (task v) hasValue _ _ = Nothing ifStable task (Value v stable) = if stable (Just (task v)) Nothing ifStable _ _ = Nothing 19

20 Recursive Tasks person1by1 :: [Person]  Task [Person] person1by1 persons = enterInformation "Add a person" [] >>* [ OnAction (Action "Add" []) (hasValue (\v  person1by1 [v : persons]), OnAction (Action "Finish" []) (always (return persons)), OnAction ActionCancel (always (return [])) ]

21 Recursive Tasks person1by1 :: [Person]  Task [Person] person1by1 persons = enterInformation "Add a person" [] -|| viewInformation "List so far.." [] persons >>* [ OnAction (Action "Add" []) (hasValue (\v  person1by1 [v : persons]), OnAction (Action "Finish" []) (always (return persons)), OnAction ActionCancel (always (return [])) ]

22 Monadic-style Monadic style: (>>=) infix 1 :: (Task a) (a  Task b)  Task b | iTask a & iTask b return :: a  Task a | iTask a (>>=) infix 1 :: (Task a) (a  Task b)  Task b | iTask a & iTask b (>>=) taska taskbf = taska >>*[OnAction ActionContinue (hasValue taskbf), OnValue (ifStable taskbf) ]

23 Simple Sum calculateSum :: Task Int calculateSum = enterInformation ("Number 1","Enter a number") [] >>= \num1  enterInformation ("Number 2","Enter another number") [] >>= \num2  viewInformation ("Sum","The sum of those numbers is:") [] (num1 + num2)

24 Overview  Introduction to Task Oriented Programming  iTask Library  Task Values  Editors  Shared Data  Sequential Tasks  Parallel Tasks  Semantics  Conclusions and Future Work

Every task produces a value of "type a" A dedicated process table (TaskList) is created as SDS enabling the parallel tasks to inspect each other What kind of task is it and who should work on it ? Parallel - I parallel :: d [(ParallelTaskType, (ReadOnlyShared (TaskList a))  Task a)]  Task [(TaskTime, TaskValue a)] | descr d & iTask a Other tasks can see the current values of the parallel tasks 25

26 Parallel - I parallel :: d [(ParallelTaskType, (ReadOnlyShared (TaskList a))  Task a)]  Task [(TaskTime, TaskValue a)] | descr d & iTask a :: ParallelTaskType= Embedded | Detached ManagementMeta :: ManagementMeta ={ title:: Maybe String, worker:: UserConstraint, role:: Maybe Role, startAt:: Maybe DateTime, completeBefore:: Maybe DateTime, notifyAt:: Maybe DateTime, priority:: TaskPriority } :: UserConstraint= AnyUser | UserWithId UserId | UserWithRole Role

27 Parallel - II parallel :: d [(ParallelTaskType, (ReadOnlyShared (TaskList a))  Task a)]  Task [(TaskTime, TaskValue a)] | descr d & iTask a :: TaskList a = { listId:: TaskListId a, items:: [TaskListItem a] } :: TaskListItem a = { taskId:: TaskId, value:: TaskValue a, taskMeta:: TaskMeta, managementMeta:: Maybe ManagementMeta, progressMeta:: Maybe ProgressMeta }

28 Parallel Task Handling parallel :: d [(ParallelTaskType, (ReadOnlyShared (TaskList a))  Task a)]  Task [(TaskTime, TaskValue a)] | descr d & iTask a appendTask :: ParallelTaskType ((ReadOnlyShared (TaskList a))  Task a) (ReadOnlyShared (TaskList a))  Task TaskId | iTask a removeTask :: TaskId (ReadOnlyShared (TaskList a))  Task Void | iTask a Only the parallel tasks have access to their process table and they can add new tasks or kill existing ones

29 Handy predefined functions based on parallel and : return values of all (embedded) parallel tasks: allTasks :: [Task a]  Task [a] | iTask a (-&&-) infixr 4 :: (Task a) (Task b)  Task (a, b)| iTask a & iTask b or: return result of (embedded) parallel tasks yielding a value as first: eitherTask:: (Task a) (Task b)  Task (Either a b)| iTask a & iTask b anyTask:: [Task a]  Task a| iTask a (-||-) infixr 3 :: (Task a) (Task a)  Task a | iTask a one-of: start two tasks, but we are only interested in the result of one of them, use the other to inform: (-||) infixl 3:: (Task a) (Task b)  Task a | iTask a & iTask b (||-) infixr 3:: (Task a) (Task b)  Task b| iTask a & iTask b

30 Handy predefined functions based on parallel allTasks :: [Task a]  Task [a] | iTask a allTasks tasks = parallel Void [(Embedded, const t) \\ t  res whereres vs = [v \\ (_,Value v _)  vs] (-&&-) infixr 4 :: (Task a) (Task b)  Task (a,b)| iTask a & iTask b (-&&-) taska taskb = parallel Void [(Embedded, \_  Left),(Embedded, \_  res where res (Value [(_, Value (Left a) _),(_,Value (Right b) _)] s)= Value (a,b) s res _= NoValue The following conversion functions have already been introduced :  infixl 1 :: (Task a) (Value a → Value b) → Task b | iTask a & iTask b  infixl 1 :: (Task a) (a → b) → Task b | iTask a & iTask b

31 Handy predefined functions based on parallel anyTask :: [Task a]  Task a | iTask a anyTask tasks = parallel Void [(Embedded, const t) \\ t  res where res (Value l _) = hd ([v \\ (_,v=:(Value _ Stable))  l] ++ [v \\ (_,v=:(Value _ _))  sortBy (\a b -> fst a > fst b) l] ++ [NoValue]) res _= NoValue (-||) infixl 3 :: (Task a) (Task b)  Task a | iTask a & iTask b (-||) taska taskb = parallel Void [(Embedded, \_  Left),(Embedded, \_  Res where res(Value [(_,Value (Left a) s),_] _)= Value a s res _= NoValue

32 Handy predefined functions based on parallel and : return values of all (embedded) parallel tasks: allTasks :: [Task a]  Task [a] | iTask a (-&&-) infixr 4 :: (Task a) (Task b)  Task (a, b)| iTask a & iTask b or: return result of (embedded) parallel tasks yielding a value as first: eitherTask:: (Task a) (Task b)  Task (Either a b)| iTask a & iTask b anyTask:: [Task a]  Task a| iTask a (-||-) infixr 3 :: (Task a) (Task a)  Task a | iTask a one-of: start two tasks, but we are only interested in the result of one of them, use the other to inform: (||-) infixr 3:: (Task a) (Task b)  Task b| iTask a & iTask b (-||) infixl 3:: (Task a) (Task b)  Task a | iTask a & iTask b assign a task to a specific user: infix 3 :: User (Task a)  Task a | iTask a

33 Standard iTask Client

34 Example: Chat with someone chat :: Task Void chat = get currentUser >>= \me  enterSharedChoice "Select someone to chat with:" [] users >>= \you  withShared ("","") (duoChat you me) duoChat you me notes = chat you toView fromView notes -||- chat me (toView o switch) (\a v  switch (fromView a v)) notes) where toView (you, me) = (Display you, Note me) fromView _ (Display you, Note me) = (you, me) switch (you, me) = (me, you) chat who toV fromV notes = updateSharedInformation ("Chat with " <+++ who) [UpdateWith toV fromV] notes >>*[OnAction (Action "Stop") always (return Void)]

35 Example: Chat with someone

36 A Text Editor - I editWithStatistics :: Task Void editWithStatistics =enterInformation "Give name of text file you want to edit..." [] >>= \fileName  let file = sharedStore fileName "" in parallel Void [ (Embedded, editFile fileName file), (Embedded, showStatistics file), (Embedded, replace initReplace file) ] >>* [ OnAction (Action "File/Quit") (always (return Void))]

37 A Text Editor - II editFile :: String (Shared String) (SharedTaskList Void)  Task Void editFile fileName sharedFile _ = updateSharedInformation ("edit " +++ fileName) view const Void where view = [UpdateWith toV fromV] toV text = Note text fromV _ (Note text) = text

38 A Text Editor - III :: Statistics = {lineCount :: Int, wordCount :: Int} derive class iTask Statistics showStatistics sharedFile _ = noStat Window where noStat :: Task Void noStat=viewInformation Void [] Void >>*[ OnAction (Action "File/Show Statistics") (always showStat) ] showStat :: Task Void showStat =viewSharedInformation "Statistics:" [ViewWith stat] sharedFile >>*[ OnAction (Action "File/Hide Statistics") (always noStat) ] stat text = {lineCount = lengthLines text, wordCount = lengthWords text} wherelengthLines "" = 0 lengthLines text = length (split "\n" text) lengthWords "" = 0 lengthWords text = length (split " " (replaceSubString "\n" " " text))

39 A Text Editor - IV :: Replace = {search :: String, replaceBy :: String} derive class iTask Replace replace cmnd sharedFile _ = noReplace cmnd where noReplace :: Replace  Task Void noReplace cmnd = viewInformation Void [] Void >>* [ OnAction (Action "File/Replace") (always (showReplace cmnd)) ] showReplace :: Replace  Task Void showReplace cmnd= updateInformation "Replace:" [] cmnd >>* [ OnAction (Action "Replace") (hasValue substitute), OnAction (Action "Cancel") (always (noReplace cmnd)) ] substitute cmnd =update (replaceSubString cmnd.search cmnd.replaceBy) sharedFile >>| showReplace cmnd

40 Incidone – Coast Guard Search and Rescue Support

41 iTask Client

42 Overview  Introduction to Task Oriented Programming  iTask Library  Task Values  Editors  Shared Data  Sequential Tasks  Parallel Tasks  Semantics  Conclusions and Future Work

Semantics The iTask system is quite powerful tasks are defined on a complex domain and are reactive multi-user system shared data structures The core is small operational semantics described in Clean readable, concise type checked by the compiler executable, one can check its behavior blueprint for implementations 43

Core - Task Values :: Task a typed unit of work which should deliver a value of type a :: TaskResult a= ValRes TimeStamp (Value a) |  e: ExcRes e & iTask e :: Value a = NoVal | Val a Stability :: Stability = Unstable | Stable 44

Semantics - What is a Task ? :: Task a:== Event *State → *((Reduct a, [(TaskNo, Response)]), *State) :: Reduct a=Reduct (TaskResult a) (Task a) :: *State = { taskNo :: TaskNo// highest unassigned number, timeStamp :: TimeStamp // current time stamp, mem :: [SharedValue] // memory shared between tasks, world :: *World// enables I/O in a pure FPL } :: SharedValue :==Dynamic Current Value Remaining Task To do 45

Semantics - Types :: Event = RefreshEvent | EditEvent TaskNo Dynamic | ActionEvent TaskNo Action :: Response = EditorResponseEditorResponse | ActionResponse ActionResponse :: EditorResponse = { description:: String, editValue :: (LocalVal, SharedVal), editing :: EditMode } :: LocalVal :== Dynamic :: SharedVal :== Dynamic :: EditMode = Editing | Displaying :: ActionResponse :== [(Action, Bool)] :: Action = Action String | ActionOk | ActionCancel |…

Semantics -Task Rewriting evaluateTask :: (Task a) *World → *(Maybe a, *World) | iTask a evaluateTask task world # st = {taskNo = 0, timeStamp = 0, mem = [], world = world} # (ma, st) = rewrite task st = (ma, st.world ) rewrite :: (Task a) *State → *(Maybe a, *State) | iTask a rewrite task st # (ev, nworld)= getNextEvent st.world # (t, nworld) = getCurrentTime nworld # ((Reduct result ntask, responses), st) = task ev {st & timeStamp = t, world = nworld} = case result of ValRes _ (Val a Stable) → (Just a, st) ExcRes _ → (Nothing, st) _ → rewrite ntask {st & world = informClients responses st.world} 47

Semantics -Task Rewriting throw :: e → Task e | iTask e throw e ev st = ((Reduct (ExcRes e) (throw e), []), st) return :: a → Task a return va ev st=:{timeStamp = t} = stable t va ev st where stable t va _ st = (Reduct (ValRes t (Val va Stable)) (stable t va),[],st) infixl 1 :: (Task a) ((Value a) → Value b) → Task b | iTask a & iTask b task conv ev st = case task ev st of (Reduct (ValRes t aval) ntask, rsp, nst) → case conv aval of Val b Stable → return b ev nst bval → ((Reduct (ValRes t bval) conv), rsp), nst) (Reduct (ExcRes e) _,_,nst) → throw e ev nst 48

iTask Core Summary - I Basic Tasks / Editor edit :: String l (RWShared r w) → (l r → Maybe a) → Task a | iTask l & iTask r Basic Tasks / Return return:: a → Task a | iTask a Basic Tasks / Exception Handling throw :: e → Task e | iTask e Shared Data Sources withShared :: a ((Shared a) → Task b) → Task b | iTask a 49

iTask Core Summary - II Combinator for Conversion of Task Values infixl 1 :: (Task a) ((Value a) → Value b) → Task b | iTask a & iTask b Combinator for Sequential Composition (>>*) infixl 1 :: (Task a) [TaskStep a b] → Task b | iTask a & iTask b :: TaskStep a b = OnAction Action((Value a) → Bool) ((Value a) → Task b) | OnValue ((Value a) → Bool) ((Value a) → Task b) | E.e: OnException (e → Task b) & iTask e Combinator for Parallel Composition parallel :: [RWShared [(Int, Reduct a)] Void] → Task [(TimeStamp, Value a)] | iTask a 50

51 Overview  Introduction to Task Oriented Programming  iTask Library  Task Values  Editors  Shared Data  Sequential Tasks  Parallel Tasks  Semantics  Conclusions and Future Work

Conclusions Task Oriented Programming New style of programming for implementing multi-user web applications Focusing on tasks, not on the underlying technology All source code in one language Client receives JSON data, dedicated interpretation for PC, Tablet, Smart Phone Core reactive tasks working on local and shared data shared data sources abstracting from any type of shared data editor: can handle all interactions sequential and parallel combinators Operational Semantics defined in Clean readable, concise, type-checked, executable blueprint for implementations 52

53 Future Work Real real-world applications Coast Guard (Bas Lijnse, PostDoc) TNO (Jurrien Schutterheim, PhD; Wessel van Staal, Master thesis) Dutch Navy (to be defined) Clean IDE …. Applicability efficiency, scalability, security, version management, collaboration existing systems… Parallel & Distributed servers (Laszlo Domoszlai, PhD, Budapest) Graphical Definition of iTasks, … Semantics Reasoning ? Proving ? Testing ? Server Dynamic Code Clean Compiler Clean Code Dynamic Linker Error Messages

54 Future Work More real-world applications (with Dutch Navy, Coast Guard, TNO) Applicability: efficiency, scalability, security, … Reasoning ? Proving ? Testing ? At run-time one can decide to evaluate a task on the client Intermediate SAPL code is just-in-time compiled to JavaScript HTML-5 features can be used Graphical Definition of iTasks Parallel executing servers Server iTask Web Service iTask Combinator Library iTask GIN Dynamic Code Clean Compiler Clean Code Dynamic Linker Error Messages

Questions ? 55