Workflow Yapceu2010

18
Illustration by xkcd used with permission: http://xkcd.com /518 1

description

This is a presentation of the Perl module Workflow available on CPAN. All examples mentioned are available as part of the workflow distribution. http://search.cpan.org/~jonasbn/Workflow/lib/Workflow.pm http://sourceforge.net/apps/mediawiki/perl-workflow/index.php?title=Main_Page

Transcript of Workflow Yapceu2010

Page 1: Workflow Yapceu2010

Illustration by xkcd used with permission: http://xkcd.com/518

1

Page 2: Workflow Yapceu2010

If you understand flowcharts you will have absolutely no problems understanding workflows...

let’s go drink

2

Page 3: Workflow Yapceu2010

If you understand flowcharts you will have absolutely no problems understanding workflows...

let’s go drink

2

Page 4: Workflow Yapceu2010

What is a workflow?A modeling and automation concept for processes, especially business related processes

Or: a way to emulate and automate processes using reusable software components

Or: a simple state machine to handle your data flow on a way suits can grasp

Or: perhaps an attempt at 4GL?

Or: plz read the wikipedia article

3

Page 5: Workflow Yapceu2010

So what is Workflow?

A not so light weight Perl framework available on CPAN, which can be used to implement actual workflows

Primarily focused on exploiting the best practice of doing configuration over coding...

Well you will have to do “some” coding

4

Page 6: Workflow Yapceu2010

a workflow consists of:

states

actions/transitions

5

Page 7: Workflow Yapceu2010

Workflows

Configurations are described in either XML or Perl - out of the box

You can even write your own workflow configuration handler. A tutorial explains how to write a YAML configuration handler

Actions (Perl methods - this is where you code)

conditions (flow controllers)

validators (Perl methods - this is where you can write code)

Persisters

Several persister options currently available and Workflow is DBI compatible

6

Page 8: Workflow Yapceu2010

<workflow> <type>Ticket</type> <description>This is the workflow for sample application Ticket</description> <persister>TestPersister</persister>

<state name="INITIAL"> <description>This is the state the workflow enters when instantiated. It's like a 'state zero' but since we're using names rather than IDs we cannot assume</description>

<!-- This action is accessible from this state by everyone --> <action name="create issue" resulting_state="CREATED"/> </state>

<state name="CREATED"> <description>State of ticket after it has been created</description> <action name="add comment" resulting_state="NOCHANGE"> <condition test="defined $context->{ticket}" /> </action>

<action name="edit issue" resulting_state="IN_PROGRESS"> <condition name="IsWorker"/> </action> </state>...

7

Page 9: Workflow Yapceu2010

<actions> <action name="create issue" class="App::Action::TicketCreate"> <description>Create a new issue</description> <field name="subject" label="Subject" description="Subject of issue" is_required="yes"/> <field name="description" label="Description" description="Description of issue" is_required="yes" /> <field name="creator" label="Creator" description="Name of user who is creating the ticket" is_required="yes" source_class="App::User"/> <field name="type" label="Type" description="Type of ticket" is_required="yes" source_list="Bug,Feature,Improvement,Task"/> <field name="due_date" label="Due Date" description="Date ticket is due (format: yyyy-mm-dd hh:mm)"/> <validator name="DateValidator"> <arg>$due_date</arg> </validator> </action>...

8

Page 10: Workflow Yapceu2010

<conditions> <condition name="IsCreator" class="App::Condition::IsCreator"/> <condition name="IsWorker" class="App::Condition::IsWorker"/> <condition name="HasUserAndTicket" class="App::Condition::HasUserAndTicket"/></conditions>

9

Page 11: Workflow Yapceu2010

<validators> <validator name="DateValidator" class="Workflow::Validator::MatchesDateFormat"> <description>Validator to ensure dates are proper</description> <param name="date_format" value="%Y-%m-%d %H:%M"/> </validator></validators>

10

Page 12: Workflow Yapceu2010

<persisters> <persister name="TestPersister" class="Workflow::Persister::DBI::ExtraData" dsn="DBI:SQLite:dbname=db/ticket.db" extra_table="workflow_ticket" extra_data_field="ticket_id"/></persisters>

11

Page 13: Workflow Yapceu2010

Criticism

Workflow is not particularly Perl-ish, it is actually quite low on black magic

Workflow is not as light weight as other CPAN/Perl modules

You cannot just call Workflow->new and be good to go

Yes - we are using patterns

12

Page 14: Workflow Yapceu2010

the Project

Small community with some nice reference implementations (OpenXPKI etc.)

High acceptance rate of patches and contributions

Project Directives:

Stability, we have people using this in production

Extensibility, we want to make Workflow as useful as possible

13

Page 15: Workflow Yapceu2010

some historyInitial implementation by Chris Winters (releases from 0.01 to 0.17).

11th. of October 2004 - Initial release to CPAN (0.10)

7th. of July 2006 Workflow handed over to me (jonasbn) for ongoing maintenance and development (my first release was 0.18)

19th. of September 2006 - Project set up at SourceForge

Latest release 1.33, January 30th. 2010, yes we release early and often - well as early and often as it makes sense

14

Page 16: Workflow Yapceu2010

future stuff...In pursuit of stability:

Aiming for higher test coverage, we have gone from: 63,4% (0.17) to 76.8% (1.33)

Workflow does currently NOT work under Perl 5.12 and newer

In pursuit of extensibility:

Evaluation of issues in RT some of these are in regard to new features and not bugs

In pursuit of a larger user base:

Aiming for more and better documentation and examples, much of the documentation seems to reflect version 0.15 - so updating and proof reading is required

15

Page 17: Workflow Yapceu2010

about me

Got interested in workflow after having worked with Oracle Workflow (a free commercial product, well free to the extent it does require Oracle)

Got excited when discovering Workflow on CPAN - all free and all open source

Took over from Chris Winters

My own workflow projects stranded, but I still hope to this day to find use of it at some point - for now I only maintain Workflow...

16

Page 18: Workflow Yapceu2010

Resourceshttp://perl-workflow.sourceforge.net/

Friendly community

Documentation Wiki

low-traffic mailing list

Subversion repository

RT queue, currently only holding two items, where one is an older patch not having been integrated yet

Irregular releases, my bad

[email protected]

17