[Catalyst] Using Workflow with Catalyst (was Making Controllers thin and Models thick)

Matt S Trout dbix-class at trout.me.uk
Sun Jul 29 18:27:06 GMT 2007


On Sun, Jul 29, 2007 at 03:52:58PM +0200, jonasbn wrote:
> Hello,
> 
> I am the current maintainer of the Workflow module on CPAN and I just  
> want to add my 2 cents here, since Matts' comments on Workflow is in  
> my opinion are both unfair and inapproriate and not particularly  
> constructive. I am sure he has more constructive criticism and I  
> would like to discuss this with him the next time we meet, since Matt  
> seems like a sensible guy.

When I wrote Workflow off there hadn't been a release in some time and the
author was available but disinterested so an active maintainer seemed unlikely
to happen and we'd tried and failed to get patches merged.

I'm glad to see that's no longer the case, but it still strikes me as
massively heavy and clumsy for the job it does - anything where the synopsis
has *four* XML files before it even gets to any code screams overengineering
at me.

And of course, Workflow::Factory is a magic global (this week under the guise
of "singleton", but it's still a magic global) so I can't rely on its
behaviour in any situation where I'm going to be running more than one app in
the same interpreter.

If I wanted to deal with overengineering -and- magic globals at the same time,
I could learn J2EE. As it is,

FACTORY->add_config_from_file(
  workflow  => 'workflow.xml',
  action    => [ 'myactions.xml', 'otheractions.xml' ],
  validator => [ 'validator.xml', 'myvalidators.xml' ],
  condition => 'condition.xml',
  persister => 'persister.xml'
);

does not compare well to

my $wf = Class::Workflow->new;

$wf->state(
  name => "new",
  transitions => [qw/accept reject/],
);

$wf->transition(
  name => "accept",
  to_state => "opened",
  body => sub {
    my ( $transition, $instance, $context ) = @_;
    return (
      owner => $context->user, # assign to the use who accepted it
    );
  },
);

to my mind. Perhaps it would be worth adding a way of setting up a workflow
in code and documenting that first rather than the XML format? (no, being
able to use four perl-syntax files instead of four XML files does -not-
count from my POV :)

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/                    http://www.shadowcat.co.uk/ 



More information about the Catalyst mailing list