t ask o riented p rogramming i n using rinus plasmeijer – bas lijnse - peter achten
DESCRIPTION
T ask O riented P rogramming i n using Rinus Plasmeijer – Bas Lijnse - Peter Achten Pieter Koopman - Steffen Michels - Jurriën Stutterheim Jan Martin Jansen (NLDA) - Laszlo Domoszlai (ELTE) Part 1/2 Radboud University Nijmegen. Overview. - PowerPoint PPT PresentationTRANSCRIPT
Task Oriented Programmingin
using
Rinus Plasmeijer – Bas Lijnse - Peter Achten Pieter Koopman - Steffen Michels - Jurriën Stutterheim
Jan Martin Jansen (NLDA) - Laszlo Domoszlai (ELTE)Part 1/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
Overview
Introduction to Task Oriented Programming
iTask Library
Task Values
Editors
Shared Data
Sequential Tasks
Parallel Tasks
Semantics
Conclusions and Future Work
4
Why Task Oriented Programming ?
Tasks are a common notion in daily life / in any organization
a task to do, assigned to one person group of people working together: collection of subtasks
statically known <-> dynamically determined managing tasks is also a task
Computers often play an important role when performing a Task
Filling in a web form Answering an email Writing a piece of text, filling in a spreadsheet, …
Many programming concepts can be seen as Tasks to be executed by a computer
Function call, procedure call, method invocation, calling a web-service, a query process, thread, "App"
Task Oriented Programming
TOPTasks as central concept
New style of programming / New programming paradigm
Declarative (focus on what instead of how)High level of abstractionNo worry about technical realization (unless they matter)
Yields a distributed running (on client and server) application coordinating the tasks to do
Can also be used for Rapid Prototypingto Formalize how work should be organizedfor Simulation (agents): what is the best way of workingfor Training: mix of real people and agentsto Show properties by testing, analysis or by formal proof (semantics formally defined)As common language for communication between domain experts and programmers
5
Task Oriented Programming with
Domain Specific Programming Language, embedded inCombinator LibrarySpecify Basic TasksDefine new tasks as a composition of other tasks, using combinators
Abstracts from: (thanks to advanced Functional Programming techniques)graphical user interfaces & handling of user-interaction(client-server) communication informing tasks about the progress made by othersinforming tasks when shared information is being changed
Resulting application: Web-Service coordinating the tasks to be done…Clients can run on computers, laptops, tablets, smart phones
6
My iTask Specification
iTasks Architecture
7
iTask Web Server
iTask Combinator
Library
My iTask Specification
iTasks Architecture
8
WEB
iTask Web Server
iTask Combinator
Library
My iTask Specification
iTask Web Server
iTask Combinator
Library
iTask Specification
Web ServiceWeb Service Web Service RPC
Computer
iTask User
iTask Client
iTask User
iTask AppLaptop
iTask Client Phone
iTask User
iTask Client
Cloud / Database
Tablet
iTask User
iTask Client
Sensor
iTask User
iTask Client
iTasks Architecture
9
10
Papers on iTasks
First paper on iTasks:iTasks: Executable Specifications of Interactive Work Flow Systems for the Web (ICFP 2007)
Extensions: iTasks for a change - Type-safe run-time change in dynamically evolving workflows (PEPM 2011)GiN: a graphical language and tool for defining iTask workflows (TFP 2011)iTask as a new paradigm for building GUI applications (IFL 2010)Getting a grip on tasks that coordinate tasks (LDTA 2011)
Semantics: An Executable and Testable Semantics for iTasks (IFL 2008)Task Oriented Programming in a Pure Functional Language (PPDP 2012)
Client site evaluation of tasks:Transparant Ajax and Client-Site Evaluation of iTasks (IFL 2007)iEditors: Extending iTask with Interactive Plug-ins (IFL 2008)
Applicability: A Conference Management System based on the iData Toolkit (IFL 2007)Web Based Dynamic Workflow Systems for C2 of Military Operations (ICCRTS 2010)Managing COPD exacerberations with telemedicine (AIME 2010)Towards Dynamic Workflows for Crisis Management (ISCRAM 2010) Capturing the Netherlands Coast Guard's SAR Workflow with iTasks (ISCRAM 2011)A Task-Oriented Incident Coordination Tool (ISCRAM 2012)
11
"Real" Prototype Applications using iTasks
Simple workflow:
Aerial project: Home Healthcare project (Peter Lucas, Bas Lijnse, e.a.)
Testing chronically lung diseases caused by smoking
Testing pregnancy disease
12
Home Healthcare project
13
"Real" Prototype Applications using iTasks
Real real-life workflow:
Crisis Management:
Capturing the Netherlands Coast Guard’s Search And Rescue Workflow
(ISCRAM 2011, Bas Lijnse, Jan Martin Jansen, Ruud Nanne, Rinus Plasmeijer)
Prototype : Coast Guard Search And Rescue
14
15
What did we learn ?
Tasks which pass information to each other (one-to-many) is not powerful enough
One has to be able to define tasks which can monitor and coordinate other tasks
Internal: monitor the status of (sub-)tasks (like a process table in an OS)External: monitor the status of the environment (e.g. status of Search And Rescue)
Tasks must be able to share & update information while the task is being performed
Many to many communication, broadcast
User definable dashboard view (windows, menus, buttons) on shared information
System should remain semantically simple, easy to use, implement, and maintain…
16
Back to the drawing board
The whole iTask system has been redesigned
More features than ever
Yet the Core of the system consists of only a few primitives
Redesigned API on top enabling easy specification of complex systems
Re-implemented kernel to gain efficiency
Under Construction ….
17
Overview
Introduction to Task Oriented Programming
iTask Library
Task Values
Editors
Shared Data
Sequential Tasks
Parallel Tasks
Semantics
Conclusions and Future Work
18
How does an i –Tasks look like ?
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
DataLocal data: Task ValuesShared data: Shared Data Sources
TasksBasic Tasks
Non-interactivereturn, throw, …
Interactive Editors
CombinatorsSequentialParallel
19
20
Overview
Introduction to Task Oriented Programming
iTask Library
Task Values
Editors
Shared Data
Sequential Tasks
Parallel Tasks
Semantics
Conclusions and Future Work
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
21
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
NoVal
22
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
NoValVal a
Unstable
23
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
NoValVal a False
24
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
25
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 :== Bool
Task Values (ValRes)have a time stamp can be observed by other tasksinfluence the set of tasks to work oncan be of any type: user defined, higher order (e.g a task or a function)must satisfy the iTask context restriction: at least have to be serializable
A Task can raise an exception (ExcRes)
26
27
Core - Simple Basic Tasks
Lift an ordinary expression to the task domain, delivers a Stable value :
return :: a → Task a | iTask a
Raise an exceptional result (ExcRes)
throw :: e → Task e | iTask e
Conversion of Task Values
(@?) 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
"Core" Definitions
28
Overview
Introduction to Task Oriented Programming
iTask Library
Task Values
Editors
Shared Data
Sequential Tasks
Parallel Tasks
Semantics
Conclusions and Future Work
ModelModel
ViewView
29
Editors - 1
module example
import iTasks
Start :: *World *WorldStart world = startEngine myTask world
myTask :: Task IntmyTask = enterInformation "Enter an integer" []
One can change the value as often as one
likes
Editors never deliver a Stable
value
ModelModel
ViewView
30
Editors - 2
:: Person = { name :: String, gender :: Gender, dateOfBirth :: Maybe Date}:: Gender = Male | Female
derive class iTask Person, Gender
myTask :: Task PersonmyTask = enterInformation "Enter your personal information" []
ModelModel
ViewView
31
Editors - 3
myTask :: Task [Person]myTask = enterInformation "Please personal information of multiple people" []
32
Types treated special…
simpleEditor :: Task NotesimpleEditor = enterInformation "Enter a piece of text" []
chooseDate :: Task DatechooseDate = enterInformation "Choose a date" []
:: Maybe a = Just a | Nothing
chooseDate2 :: Task (Maybe Date)chooseDate2 = enterInformation "Choose a date" []
import GoogleMaps
pointOnMap :: Task GoogleMappointOnMap = enterInformation "Show me the location(s)" []
33
Examples of Editors…
taskInt :: Task InttaskInt = enterInformation "Please enter a value" []
taskInt2 :: Task InttaskInt2 = updateInformation "Please enter a value" [] 42
chooseNumber :: Task IntchooseNumber = enterChoice "Choose a number" [] [0..9]
pizzaWith :: Task [String]pizzaWith = enterMultipleChoice "What do you like on your pizza ?" []
["Cheese","Tomato","Ansjofish","Salami"]
34
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 oupdateChoice :: d [ChoiceOption o] [o] o Task o | descr d & iTask o
enterMultipleChoice :: d [MultiChoiceOption o] [o] Task [o] | descr d & iTask oupdateMultipleChoice :: d [MultiChoiceOption o] [o] [o] Task [o] | descr d & iTask o
35
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
Task Description
View on a
Resulting Type Value a
Context Restriction
36
Types used for interaction tasks…
viewInformation :: d [ViewOption a] a Task a | descr d & iTask a
:: ViewOption a = E.v: ViewWith (a v) & iTask v
Any view can be chosen
Define how to map value a to
view vContext
Restrictionincluded in the
Algebraic Datatype
37
Interactive Editors (see InteractionTasks.dcl)
viewInformation :: d [ViewOption a] a Task a | descr d & iTask a
myList1 = viewInformation "View the numbers from 1 to 10" [] [1..10]
myList2 = viewInformation "View the numbers from 1 to 10" [ViewWith (map (\n "Number: " <+++ n))]
[1..10]
38
Types used for interaction tasks…
enterInformation :: d [EnterOption a] Task a | descr d & iTask a
:: EnterOption a = E.v: EnterWith (v a) & iTask v
Any view can be chosen
Define how to map view v to
value a
Context Restriction
39
Types used for interaction tasks…
updateInformation :: d [UpdateOption a a] a Task a | descr d & iTask a
:: UpdateOption a b = E.v: UpdateWith (a v) (a v b) & iTask v
Any view can be chosen
Define how to map view v to
value aContext
Restriction
Any view can be chosen
Define how to map the view v
back to a value b given the current
value a
Context Restriction
Define how to map value a to
view v
40
Types used for interaction tasks…
:: ViewOption a = E.v: ViewWith (a v) & iTask v:: EnterOption a = E.v: EnterWith (v a) & iTask v:: UpdateOption a b = E.v: UpdateWith (a v) (a v b) & iTask v:: ChoiceOption a = E.v: ChooseWith ChoiceType (a
v) & iTask v:: MultiChoiceOption a = E.v: ChooseMultipleWith MultiChoiceType (a v) & iTask v:: ChoiceType = AutoChoice
| ChooseFromComboBox| ChooseFromRadioButtons| ChooseFromGrid| ChooseFromTree
:: MultiChoiceType = AutoMultiChoice| ChooseFromCheckBoxes
41
Types used for interaction tasks…
viewInformation :: d [ViewOption a] a Task a | descr d & iTask a
class descr d where initAttributes :: d [TaskAttribute]
instance descr Void, String, (String, String) , (Icon, String, String) , …
class iTask a | gVisualizeEditor {|*|} // creates a form editor, gVisualizeText {|*|} // converts text to html code, gHeaders {|*|} // grid header for record field name, gGridRows {|*|} // grid row for record value, gUpdate {|*|} // handles a form update, gVerify {|*|} // verifies values filled in, JSONDecode {|*|} // convert to JSON to communicate / store, JSONEncode {|*|} // convert from JSON, gEq {|*|} // to compare values / web screens, TC a // conversion to and from Dynamics
42
Types used for interaction tasks…
generic gVisualizeEditor a | gVisualizeText a, gHeaders a, gGridRows a :: (Maybe a) *VSt (VisualizationResult,*VSt)
generic gVisualizeText a :: StaticVisualizationMode a [String] generic gUpdate a :: (UpdateMode a) *USt (a, *USt)generic gHeaders a :: a [String]generic gGridRows a | gVisualizeText a
:: a [String] Maybe [String]generic gVerify a :: (Maybe a) *VerSt *VerStgeneric JSONEncode t :: t [JSONNode]generic JSONDecode t :: [JSONNode] (Maybe t, [JSONNode])generic gEq a :: a a Bool
TC is a special class automatically instantiated by the compiler for every “known” type…toDynamic :: a Dynamic | TC afromDynamic :: Dynamic a | TC a
43
Overview
Introduction to Task Oriented Programming
iTask Library
Task Values
Editors
Shared Data
Sequential Tasks
Parallel Tasks
Semantics
Conclusions and Future Work