1 / 43

T ask O riented P rogramming i n using Rinus Plasmeijer – Bas Lijnse - Peter Achten

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.

ermin
Download Presentation

T ask O riented P rogramming i n using Rinus Plasmeijer – Bas Lijnse - Peter Achten

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  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"

  5. Task Oriented Programming • TOP • Tasks as central concept • New style of programming / New programming paradigm • Declarative (focus on what instead of how) • High level of abstraction • No 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 Prototyping • to Formalize how work should be organized • for Simulation (agents): what is the best way of working • for Training: mix of real people and agents • to Show properties by testing, analysis or by formal proof (semantics formally defined) • As common language for communication between domain experts and programmers

  6. Task Oriented Programming with • Domain Specific Programming Language, embedded in • Combinator Library • Specify Basic Tasks • Define 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 others • informing 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

  7. iTasks Architecture My iTask Specification

  8. iTasks Architecture iTask Web Server iTask Combinator Library My iTask Specification

  9. iTasks Architecture iTask App Computer Laptop Sensor Tablet Phone iTask Client iTask Client iTask Client iTask Client iTask Client iTask User WEB Cloud / Database iTask User iTask User iTask User iTask User Web Service RPC Web Service Web Service iTask Web Server iTask Web Server iTask Combinator Library iTask Combinator Library iTask Specification My iTask Specification

  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)

  14. Prototype : Coast Guard Search And Rescue

  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 …. VERSION 3 !

  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 • iTaskCore • 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 • + iTaskLibrary 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

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

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

  21. Core - Task Values • :: Task atyped unit of work which should deliver a value of type a • While the task is going on, its value may change over time

  22. Core - Task Values • :: Task atyped unit of work which should deliver a value of type a • While the task is going on, its value may change over time NoVal

  23. Core - Task Values • :: Task atyped unit of work which should deliver a value of type a • While the task is going on, its value may change over time NoVal Val a Unstable

  24. Core - Task Values • :: Task atyped unit of work which should deliver a value of type a • While the task is going on, its value may change over time NoVal Val a False

  25. Core - Task Values • :: Task atyped unit of work which should deliver a value of type a • While the task is going on, its value may change over time NoVal Val a False Vala True

  26. Core - Task Values • :: Task atyped 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 = ValResTimeStamp (Value a) • | e: ExcRese & iTask e • :: Value a = NoVal • | Vala Stability • :: Stability :== Bool • Task Values (ValRes) • have a time stamp • can be observed by other tasks • influence the set of tasks to work on • can 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) NoVal Val a False Vala True

  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

  29. Editors - 1 • module example • import iTasks • Start:: *World *World • Start world = startEngine myTask world • myTask :: Task Int • myTask = enterInformation "Enter an integer" [] One can change the value as often as one likes Editors never deliver a Stable value Model View

  30. Editors - 2 • :: Person = { name :: String, gender :: Gender, dateOfBirth :: Maybe Date} • :: Gender = Male | Female • derive classiTaskPerson, Gender • myTask :: Task Person • myTask = enterInformation "Enter your personal information" [] Model View

  31. Editors - 3 • myTask :: Task [Person] • myTask = enterInformation "Please personal information of multiple people" [] Model View

  32. Types treated special… • simpleEditor :: Task Note • simpleEditor = enterInformation "Enter a piece of text" [] • chooseDate :: Task Date • chooseDate = enterInformation "Choose a date" [] • :: Maybe a = Justa | Nothing • chooseDate2 :: Task (Maybe Date) • chooseDate2 = enterInformation "Choose a date" [] • import GoogleMaps • pointOnMap :: Task GoogleMap • pointOnMap = enterInformation "Show me the location(s)" []

  33. Examples of Editors… • taskInt :: Task Int • taskInt = enterInformation "Please enter a value" [] • taskInt2 :: Task Int • taskInt2 = updateInformation "Please enter a value" [] 42 • chooseNumber:: Task Int • chooseNumber = 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 [ChoiceOptiono] [o]  Task o | descr d & iTask o • updateChoice :: d [ChoiceOptiono] [o] o Task o | descr d & iTask o • enterMultipleChoice :: d [MultiChoiceOptiono] [o] Task [o] | descr d & iTask o • updateMultipleChoice :: d [MultiChoiceOptiono] [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 Define how to map value a to view v Any view can be chosen Context Restriction included 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 Define how to map view v to value a Any view can be chosen 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 Define how to map the view v back to a value b given the current value a Define how to map value a to view v Any view can be chosen Context Restriction Define how to map view v to value a Any view can be chosen Context Restriction

  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: ChooseWithChoiceType (a  v) & iTask v • ::MultiChoiceOption a = E.v: ChooseMultipleWithMultiChoiceType (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 • classdescr d whereinitAttributes :: d[TaskAttribute] • instancedescrVoid, String, (String, String) , (Icon, String, String) , … • classiTask 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… • genericgVisualizeEditor a |gVisualizeText a, gHeaders a, gGridRows a • :: (Maybe a) *VSt  (VisualizationResult,*VSt) • genericgVisualizeText a :: StaticVisualizationMode a  [String] • genericgUpdate a :: (UpdateMode a) *USt  (a, *USt) • genericgHeaders a::a  [String] • genericgGridRows a| gVisualizeText a • :: a [String]  Maybe [String] • genericgVerify a :: (Maybe a) *VerSt *VerSt • genericJSONEncode t :: t  [JSONNode] • genericJSONDecode t :: [JSONNode]  (Maybe t, [JSONNode]) • genericgEq a :: a a  Bool • TC is a special class automatically instantiated by the compiler for every “known” type… • toDynamic :: a Dynamic |TCa • fromDynamic ::Dynamic  a |TCa

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

More Related