Title: iTasks interactive workflow tasks for the WEB ___________ WORK IN PROGRESS
1i-Tasks-interactive workflow tasksfor the
WEB___________ WORK IN PROGRESS
Rinus Plasmeijer - Peter Achten University of
Nijmegen www.cs.ru.nl/clean
2Overview of the talk
- challenge STW project demand driven
workflows - simple approach iTasks workflows based on
i-Data - iData
- iTasks
- Conclusions
3Previous work on Graphical Editor Components
- Can we use generic programming techniques to
generate interactive desktop applications ? - Yes Graphical Editor Components (IFL '03, PADL
'04, APLAS '04). - For any (higher order) type,an editor for values
of that type can be constructed automatically
4Previous work on Graphical Editor Components
- Can we use generic programming techniques to
generate interactive desktop applications ? - Yes Graphical Editor Components (IFL '03, PADL
'04, APLAS '04). - For any (higher order) type,an editor for values
of that type can be constructed automatically - Can we use generic programming techniques to
generate interactive web forms ? - Yes i-Data (FLOPS '06, IFL '05, IFL 06).
5Previous work on Graphical Editor Components
- Can we use generic programming techniques to
generate interactive desktop applications ? - Yes Graphical Editor Components (IFL '03, PADL
'04, APLAS '04). - For any (higher order) type,an editor for values
of that type can be constructed automatically - Can we use generic programming techniques to
generate interactive web forms ? - Yes i-Data (FLOPS '06, IFL '05, IFL 06).
- Can we use generic programming techniques to
generate interactive multi-user workflow systems
for the web ? - Yes i-Tasks
6i-Data Interactive Data
An i-Data is a persistent typed object it lives
longer then the application.
7One function to create an i-Data object of any
type
- mkEdit (Init, FormId d) ? HSt ? (Form d,
HSt) iData d - Init
- Init Set // Get or Set current value
- FormId d
- initval d // value
- , id String // unique web form id
- , mode Mode // Edit, Submit, Display,
NoForm - , lifespan Lifespan // Page, Session, File,
Database - , storage StorageFormat // String, Dynamic
- HSt // Unique (abstract) data type
- Form d
- changed Bool // has the user edited the
form ? - , value d // current value in data domain
(feel) - , form BodyTag // html code
representing view domain (look)
8Example 1 An editor for an integer value
- example hst
- (idata, hst) mkEdit (Init, nFormId myform
initVal) hst - mkHtml Txt Editor Example
- , Br
- , BodyTag idata.form
- hst
- initVal Int
- initVal createDefault
9Example 2 An editor for a list of integers
- example hst
- (idata,hst) mkEdit (Init, nFormId myform
initVal) hst - mkHtml Txt Editor Example
- , Br
- , BodyTag idata.form
- hst
- initVal Int
- initVal createDefault
10Example 3 An editor for a record structure
- example hst
- (idata,hst) mkEdit (Init, nFormId myform
initVal) hst - mkHtml Txt Editor Example
- , Br
- , BodyTag idata.form
- hst
- initVal Person
- initVal createDefault
- Person name String
- , street String
- , number Int
- , zipCode String
- , town String
- derive gForm Person gUpd Person gPrint Person
gParse Person gerda Person
11Example 4 An editor for a list of records
- example hst
- (idata,hst) mkEdit (Init, nFormId myform
initVal) hst - mkHtml Txt Editor Example
- , Br
- , BodyTag idata.form
- hst
- initVal Person
- initVal createDefault
- Person name String
- , street String
- , number Int
- , zipCode String
- , town String
12Example 4 A user defined editor for a list of
records
- example hst
- (idata,hst) listEdit (Init, nFormId myform
initVal) hst - mkHtml Txt Editor Example
- , Br
- , BodyTag idata.form
- hst
- initVal Person
- initVal createDefault
- Person name String
- , street String
- , number Int
- , zipCode String
- , town String
13Example Clean's CD shop
14Conclusions iData
- Nice
- High-level easy-to-read specification of
complicated web forms - Many low level things are handled automatically
- dealing with interaction over the web
- storage and retrieval in pages, files, databases
- Good separation between model and view
- Specialisation possible that allows to redefine
any view of any type - Also multi-user applications easy to realize
- Nice, clear relative simple implementation based
on generic functions - One function does it all !
-
-
-
15Sequence of numbers
- sequenceIData hst
- (done1, idata1, hst) myEdit task1" initVal
hst - (done2, idata2, hst) myEdit task2" initVal
hst - mkHtml "Solution using iData without iTasks"
- BodyTag idata1.form
- , if done1 (BodyTag idata2.form) EmptyBody
- , if done2 (BodyTag Txt "
- ,Hr
- ,toHtml (idata1.value idata2.value))
EmptyBody - hst
- where
- myEdit String a HSt ? (Bool, Form a, HSt)
iData a
16Conclusions iData
-
- Not so nice
- good in event-driven applications, bad in
application-driven workflows - no support for easy definition of such
workflows - one single i-Data application is re-started on
each event - persistent state editor used to remember and
control the workflow - one has to think about prompting and what to show
or not -
-
- programmer has to invent new unique names for
iData forms -
-
17iTask approach
- Study Workflow Patterns (Van der Aalst, ter
Hofstede, Kiepuszewski, Barros) - pruducts Staffware, Cosa, InConcert, Eastman
Software, FLOWer, Domino Workflow, Meteor,
Mobile, MQSeries, Forte Conductor,Verve, Visual
WorkFlo, Changengine, I-Flow, SAP R/3 Workflow - patterns sequence, recursion, exclusive choice,
multiple choice, split/merge (parallel or,
parallel and, discriminator), ... - All Workflow Patterns can straightforwardly be
implemented - For each pattern define a combinator on top of
iData - Composition by using monadic operators / Cleans
unique state handling - Form names are generated automatically in a
systematic way - Remember evaluation path of the tasks
- iTasks
- are typed (most workflow systems are not)
- and have all the advantages of iData (highly
reusable)
18Sequence of numbers, iTask, monadic state
- sequenceITaskM (Task a) iData a a
- sequenceITaskM
- STask "Set" initVal
- gtgt \v1 -gt STask "Set" initVal
- gtgt \v2 -gt Txt "", Hr
- !gtgt returnTask (v1 v2)
19Sequence of numbers, iTask, explicite unique state
- sequenceITask (Task a) iData a a
- sequenceITask mytask
- where
- mytask tst
- (v1,tst) STask "Set" initVal tst
- (v2,tst) STask "Set" initVal tst
- tst returnF Txt "", Hr tst
- returnTask (v1 v2) tst
20Sequence of numbers, iTask, multi-user
- sequenceITaskMU (Task a) iData a a
- sequenceITaskMU
- (1,"number") _at_ STask "Set" initVal
- gtgt \v1 -gt (2,"number") _at_ STask "Set" initVal
- gtgt \v2 -gt Txt "", Hr
- !gtgt returnTask (v1 v2)
21Recursion
- repeatTask (Task a) -gt (Task a) iData a
- repeatTask task
- task
- gtgt mkTask (repeatTask task)
- example
- repeatTask CoffeeMachine
22Coffeemachine (1/2)
- CoffeeMachine Task (String, Int)
- CoffeeMachine
- Txt "Choose product", Br, Br
- ?gtgt CTask_button
- ("Coffee 100", returnV (100,"Coffee"))
- , ("Cappucino 150", returnV
(150,"Cappucino")) - , ("Tee 50", returnV (50, "Tee"))
- , ("Choclate 100", returnV
(100,"Choclate")) -
- gtgt \(toPay, product) -gt Txt ("Chosen product
" lt product), Br, Br - ?gtgt getCoins (toPay, 0)
- gtgt \(cancel, returnMoney)
- -gt let nproduct if cancel
"Cancelled" product in - Txt ("product " lt nproduct lt ",
- returned money " lt returnMoney), Br,
Br - ?gtgt STask_button "Thanks" (returnV Void)
- gtgt returnV (nproduct, returnMoney)
23Coffeemachine (2/2)
- getCoins (Int, Int) -gt Task (Bool, Int)
- getCoins (toPay, paid)
- Txt ("To pay " lt toPay), Br, Br
- ?gtgt PCTask2
- ( CTask_button (toString i lt " cts",
returnV (False, i)) - \\ i lt- 5,10,20,50,100,200
-
- , STask_button "Cancel" (returnV (True, 0))
- )
- gtgt \(cancel, coin) -gt handleCoin (cancel,
coin) - where
- handleCoin (cancel, coin)
- cancel returnV (True, paid)
- toPay - coin gt 0 mkTask (getCoins (toPay -
coin, paid coin)) - otherwise returnV (False, coin - toPay)
-
24Review Task (1/3)
- ReviewState Approved Cancelled
NeedsRework TextArea Draft - taskToReview Int (Task a, a, ReviewState) -gt
Task (a, ReviewState) iData a - taskToReview reviewer (task, value, review)
- task value
- gtgt \value -gt reviewer _at_ reviewTask value
- gtgt \review -gt Txt ("Reviewer " lt reviewer
lt " says "), toHtml review, Br - ?gtgt STask "OK" Void
- gtgt case review of
- (NeedsRework _) -gt mkTask (taskToReview
reviewer (task, value, review)) - else -gt returnV (value, review)
-
25Review Task (2/3)
- reviewTask a -gt Task ReviewState iData a
- reviewTask value,
- toHtml value, Br, Br
- ?gtgt CTask_button
- ("Rework", STask "Done"
(NeedsRework initVal) ltlt_at_ Submit) - , ("Approved", returnV Approved)
- , ("Cancel", returnV Cancelled)
-
26Review Task (3/3)
- QForm toComp String
- , startDate HtmlDate
- , endDate HtmlDate
- , estimatedHours Int
- , description TextArea
- , price Real
-
- Quotation Task (QForm, ReviewState)
- Quotation taskToReview 1 (mytask, initVal,
initVal) - mytask form Txt "Fill in Form", Br, Br
- ?gtgt STask "TaskDone" form ltlt_at_ Submit
27Conclusions iTasks
-
- Nice intuitive notation
- All "standard" workflows patterns offered
- Workflow diagrams can straightforwardly be
translated to iTasks code - Typed workflows,Typed input
- iData based very high re-usability of code
- Simple implementation where evaluation order of
tasks is remembered using iData - One application serves multiple users