Workflow Yapceu2010


Published on

This is a presentation of the Perl module Workflow available on CPAN. All examples mentioned are available as part of the workflow distribution.

Published in: Technology
1 Like
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Workflow Yapceu2010

  1. 1. Illustration by xkcd used with permission: 1
  2. 2. If you understand flowcharts you will have absolutely no problems understanding workflows... 2
  3. 3. If you understand flowcharts you will have absolutely no problems understanding workflows... let’s go drink 2
  4. 4. 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
  5. 5. 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
  6. 6. a workflow consists of: states actions/transitions 5
  7. 7. 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
  8. 8. <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
  9. 9. <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
  10. 10. <conditions> <condition name="IsCreator" class="App::Condition::IsCreator"/> <condition name="IsWorker" class="App::Condition::IsWorker"/> <condition name="HasUserAndTicket" class="App::Condition::HasUserAndTicket"/> </conditions> 9
  11. 11. <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
  12. 12. <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
  13. 13. 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
  14. 14. 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
  15. 15. some history Initial 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
  16. 16. 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
  17. 17. 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
  18. 18. Resources 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 17