You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Ugo Cei <u....@cbim.it> on 2003/11/12 22:25:31 UTC

Re: [vote] forbidding flowscripts with no sendpage redirects (was Re: Saving pipeline output to a temp file...)

Tim Olson wrote:
> <map:match action="*/profile/edit">
>   <map:call function="dumpUserData"/>
>   <map:call function="dumpOrderData"/>
>   <map:call function="dumpNewsItems"/>
>   <map:generate src="cocoon://generate"/>
>   <map:transform src="homePage.xsl"/>
>   <map:serialize/>
> </map:match>

  <map:match pattern="*/profile/edit">
    <map:call function="dumpData"/>
  </map:match>

  <map:match pattern="view">
    <map:generate src="cocoon://generate"/>
    <map:transform src="homePage.xsl"/>
    <map:serialize/>
  </map:match>

function dumpData() {
   dumpUserData();
   dumpOrderData();
   dumpNewsItems();
   cocoon.sendPage("view");
}

      Ugo






Re: [vote] forbidding flowscripts with no sendpage redirects (was Re: Saving pipeline output to a temp file...)

Posted by Joerg Heinicke <jh...@virbus.de>.
On 13.11.2003 00:20, Andrzej Jan Taramina wrote:

>>  <map:match pattern="*/profile/edit">
>>    <map:call function="dumpData"/>
>>  </map:match>
>>
>>  <map:match pattern="view">
>>    <map:generate src="cocoon://generate"/>
>>    <map:transform src="homePage.xsl"/>
>>    <map:serialize/>
>>  </map:match>
>>
>>function dumpData() {
>>   dumpUserData();
>>   dumpOrderData();
>>   dumpNewsItems();
>>   cocoon.sendPage("view");
>>}
>>
> 
> 
> The main problem I have with this approach is that without looking at the 
> script code, there is no easy way of telling that the first match will end up 
> calling the second one and so the flow of the application becomes more 
> opaque...and thus harder to understand and maintain.
> 
> I like Tim's approach much better....where everything is in one place and the 
> high level flow of control is quite clear and transparent.

For the moment it's better to have this that restrictive. But have a 
look at the recent thread "[RT] Is flowscript polluting sitemap 
readability?". Maybe, but really only maybe as it was only a random 
thought and we must think about the concept, there will be a Selector in 
the future that leads the sitemap flow depending on the result of the 
flow script. This brings the light back to the sitemap and can reduce 
opaqueness ;-)

And this will remove the need for such an action-like behaviour you and 
Tim relied on. BTW what exactly should the FlowAction do? I didn't 
follow the thread closely. If it does that what I imagine (or fear) we 
are back to actions and don't need any flow. I like the Selector 
approach much more. But let's discuss it at that thread.

Joerg


Re: [vote] forbidding flowscripts with no sendpage redirects (was Re: Saving pipeline output to a temp file...)

Posted by Stefano Mazzocchi <st...@apache.org>.
On 13 Nov 2003, at 00:20, Andrzej Jan Taramina wrote:

> Ugo suggested:
>
>>   <map:match pattern="*/profile/edit">
>>     <map:call function="dumpData"/>
>>   </map:match>
>>
>>   <map:match pattern="view">
>>     <map:generate src="cocoon://generate"/>
>>     <map:transform src="homePage.xsl"/>
>>     <map:serialize/>
>>   </map:match>
>>
>> function dumpData() {
>>    dumpUserData();
>>    dumpOrderData();
>>    dumpNewsItems();
>>    cocoon.sendPage("view");
>> }
>>
>
> The main problem I have with this approach is that without looking at 
> the
> script code, there is no easy way of telling that the first match will 
> end up
> calling the second one and so the flow of the application becomes more
> opaque...and thus harder to understand and maintain.

True. [see the other thread on flow polluting sitemap readability]

> I like Tim's approach much better....where everything is in one place 
> and the
> high level flow of control is quite clear and transparent.

nah, it follows the same patter of action: it's cool when it's nice and 
clean and simple... but the more complex it becomes the more it blows 
in your face, we must be more creative to solve this issue.

> also glad to see that I am not the only one that has used this 
> paradigm.
> <grins>

yeah, sounds like "millions of outlook users can't be wrong" as an add 
campaign ;-)

> An action that will call a flowscript for you without the sendPage
> restriction would seem to be a reasonable alternative, in which case 
> Tony's
> code then looks like:
>
> <map:match action="*/profile/edit">
> 	<map:act type="FlowscriptAction"  function="dumpUserData">
> 		<map:call function="dumpOrderData"/>
> 		<map:call function="dumpNewsItems"/>
> 		<map:generate src="cocoon://generate"/>
> 		<map:transform src="homePage.xsl"/>
> 		<map:serialize/>
> 	</map:act>
> 	... error stuff can go here...
> </map:match>

you all the function twice? c'mon.

> Which I like even better...since you have the ability to branch the 
> flow
> based on success/failure of the action.  You could also allow 
> parameters as
> input to the function by doing something like:
>
> <map:act type="FlowscriptAction"  function="dumpUserData">
> 	<map:parameter value="xxx"/> <!-- name attribute could be ignored -->
> 	<map:parameter value="yyy"/>
>      .... as before

here you go, told you.

> where the method signature of dumpUserData would look like
>
> 	function dumpUserData( xValue, yValue ) {....}
>
> Clean...crisp...understandable...functional....and doesn't clutter the
> architecture.

bah, we have different tastes.

> +1 from me for the FlowscriptAction approach and soon too!

I think the selector idea is much better, let's work on that.

--
Stefano.

Re: [vote] forbidding flowscripts with no sendpage redirects (was Re: Saving pipeline output to a temp file...)

Posted by Ugo Cei <u....@cbim.it>.
Reinhard Poetz wrote:
> I don't like it that we blur the Flowscript concept to achieve things
> that can already be done today nearly in the same way some of you
> propose. In the long run I fear that nobody knows what the Cocoon
> Control flow is about and everybody talks about different things. I
> think this harms Cocoon more than it helps. So please come up with
> usecases which make it really necessary to go this way!

Amen brother ;-).

> ... but maybe I'm the only one with these thoughts ...

We are at least two.

	Ugo


-- 
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: u.cei@cbim.it


RE: [vote] forbidding flowscripts with no sendpage redirects (was Re: Saving pipeline output to a temp file...)

Posted by Reinhard Poetz <re...@apache.org>.
From: Andrzej Jan Taramina
 
> Ugo suggested:
> 
> >   <map:match pattern="*/profile/edit">
> >     <map:call function="dumpData"/>
> >   </map:match>
> > 
> >   <map:match pattern="view">
> >     <map:generate src="cocoon://generate"/>
> >     <map:transform src="homePage.xsl"/>
> >     <map:serialize/>
> >   </map:match>
> > 
> > function dumpData() {
> >    dumpUserData();
> >    dumpOrderData();
> >    dumpNewsItems();
> >    cocoon.sendPage("view");
> > }
> > 
> 
> The main problem I have with this approach is that without 
> looking at the 
> script code, there is no easy way of telling that the first 
> match will end up 
> calling the second one and so the flow of the application 
> becomes more 
> opaque...and thus harder to understand and maintain.
> 
> I like Tim's approach much better....where everything is in 
> one place and the 
> high level flow of control is quite clear and transparent.
> 
> also glad to see that I am not the only one that has used 
> this paradigm.  
> <grins>
> 
> An action that will call a flowscript for you without the sendPage 
> restriction would seem to be a reasonable alternative, in 
> which case Tony's 
> code then looks like:
> 
> <map:match action="*/profile/edit">
> 	<map:act type="FlowscriptAction"  function="dumpUserData">
> 		<map:call function="dumpOrderData"/>
> 		<map:call function="dumpNewsItems"/>
> 		<map:generate src="cocoon://generate"/>
> 		<map:transform src="homePage.xsl"/>
> 		<map:serialize/>
> 	</map:act>
> 	... error stuff can go here...
> </map:match>
> 
> Which I like even better...since you have the ability to 
> branch the flow 
> based on success/failure of the action.  You could also allow 
> parameters as 
> input to the function by doing something like:
> 
> <map:act type="FlowscriptAction"  function="dumpUserData">
> 	<map:parameter value="xxx"/> <!-- name attribute could 
> be ignored -->
> 	<map:parameter value="yyy"/>
>      .... as before
> 
> where the method signature of dumpUserData would look like
> 
> 	function dumpUserData( xValue, yValue ) {....}
> 
> Clean...crisp...understandable...functional....and doesn't 
> clutter the 
> architecture.
> 
> +1 from me for the FlowscriptAction approach and soon too!


I followed this discussion the last days and I'm still wondering why you
need this "FlowscriptAction". If you need an Action then use an Action.
What's the problem? If you say you want the fast development cycles of
Flowscript because it is interpreted then use an XSP-Action (which
should be nearly as fast)[1]

I don't like it that we blur the Flowscript concept to achieve things
that can already be done today nearly in the same way some of you
propose. In the long run I fear that nobody knows what the Cocoon
Control flow is about and everybody talks about different things. I
think this harms Cocoon more than it helps. So please come up with
usecases which make it really necessary to go this way!

... but maybe I'm the only one with these thoughts ...

--
Reinhard


[1] I've to admit that I have never used it but only read about it
(http://wiki.cocoondev.org/Wiki.jsp?page=XSPAction)


Re: [vote] forbidding flowscripts with no sendpage redirects (was Re: Saving pipeline output to a temp file...)

Posted by Andrzej Jan Taramina <an...@chaeron.com>.
Ugo suggested:

>   <map:match pattern="*/profile/edit">
>     <map:call function="dumpData"/>
>   </map:match>
> 
>   <map:match pattern="view">
>     <map:generate src="cocoon://generate"/>
>     <map:transform src="homePage.xsl"/>
>     <map:serialize/>
>   </map:match>
> 
> function dumpData() {
>    dumpUserData();
>    dumpOrderData();
>    dumpNewsItems();
>    cocoon.sendPage("view");
> }
> 

The main problem I have with this approach is that without looking at the 
script code, there is no easy way of telling that the first match will end up 
calling the second one and so the flow of the application becomes more 
opaque...and thus harder to understand and maintain.

I like Tim's approach much better....where everything is in one place and the 
high level flow of control is quite clear and transparent.

also glad to see that I am not the only one that has used this paradigm.  
<grins>

An action that will call a flowscript for you without the sendPage 
restriction would seem to be a reasonable alternative, in which case Tony's 
code then looks like:

<map:match action="*/profile/edit">
	<map:act type="FlowscriptAction"  function="dumpUserData">
		<map:call function="dumpOrderData"/>
		<map:call function="dumpNewsItems"/>
		<map:generate src="cocoon://generate"/>
		<map:transform src="homePage.xsl"/>
		<map:serialize/>
	</map:act>
	... error stuff can go here...
</map:match>

Which I like even better...since you have the ability to branch the flow 
based on success/failure of the action.  You could also allow parameters as 
input to the function by doing something like:

<map:act type="FlowscriptAction"  function="dumpUserData">
	<map:parameter value="xxx"/> <!-- name attribute could be ignored -->
	<map:parameter value="yyy"/>
     .... as before

where the method signature of dumpUserData would look like

	function dumpUserData( xValue, yValue ) {....}

Clean...crisp...understandable...functional....and doesn't clutter the 
architecture.

+1 from me for the FlowscriptAction approach and soon too!


Andrzej Jan Taramina
Chaeron Corporation: Enterprise System Solutions
http://www.chaeron.com