You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by "Gregor J. Rothfuss" <gr...@apache.org> on 2004/12/25 06:47:57 UTC

tasks vs usecases

it seems to me that we can replace the ant tasks in lenya that are used 
as "backends" for most of our usecases today with proper usecase classes 
that do extend AbstractUsecase or DocumentUsecase.

open questions:

how do we schedule usecases? (the scheduler, which is currently a 
seperate servlet, interacts with tasks.)

how do we set the workflow situation from a usecase? (there is a 
getSituation, but not a setSituation in AbstractUsecase)

-- 
Gregor J. Rothfuss
COO, Wyona       Content Management Solutions    http://wyona.com
Apache Lenya                              http://lenya.apache.org
gregor.rothfuss@wyona.com                       gregor@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail:              dev-unsubscribe@lenya.apache.org
For additional commands, e-mail:            dev-help@lenya.apache.org
Apache Lenya Project                          http://lenya.apache.org


Re: tasks vs usecases

Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann wrote:

[...]

>> how do we set the workflow situation from a usecase? (there is a 
>> getSituation, but not a setSituation in AbstractUsecase)
> 
> 
> We could probably just add the setSituation() method to the
> Usecase interface and pass the situation from the flowscript
> (where it is already available).

This is not necessary, as the situation is already obtained
by AbstractUsecase. I added methods to conviniently invoke a
workflow event on a document to AbstractUsecase and DocumentUsecase.

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail:              dev-unsubscribe@lenya.apache.org
For additional commands, e-mail:            dev-help@lenya.apache.org
Apache Lenya Project                          http://lenya.apache.org


Re: tasks vs usecases

Posted by Andreas Hartmann <an...@apache.org>.
Gregor J. Rothfuss wrote:
> it seems to me that we can replace the ant tasks in lenya that are used 
> as "backends" for most of our usecases today with proper usecase classes 
> that do extend AbstractUsecase or DocumentUsecase.
> 
> open questions:
> 
> how do we schedule usecases? (the scheduler, which is currently a 
> seperate servlet, interacts with tasks.)

This question bothers me for quite a long time ...
I guess it needs more brainstorming, feel free to make
proposals.

> how do we set the workflow situation from a usecase? (there is a 
> getSituation, but not a setSituation in AbstractUsecase)

We could probably just add the setSituation() method to the
Usecase interface and pass the situation from the flowscript
(where it is already available).

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail:              dev-unsubscribe@lenya.apache.org
For additional commands, e-mail:            dev-help@lenya.apache.org
Apache Lenya Project                          http://lenya.apache.org


Re: tasks vs usecases

Posted by Michael Wechner <mi...@wyona.com>.
Andreas Hartmann wrote:

>
> Ant tasks turned out to add extra complexity to the architecture.
> Another problem is the lack of error handling support.


right

>
>
> In the future, I would discourage the usage of Ant for CMS functions.


I would discourage the usage of the current ant task implementation, but
not the idea of it. I agree that the current implementation has problems,
and one reason for that might be ant itself (e.g. exception handling) as
it currently exists.

it seems to me that all these "template languages" (ant build file, 
cocoon sitemap, XSLT, ...) have the same problem: "logic" and exception 
handling are basically missing or are implemented through workarounds 
which don't work that well.

I think a major evolutionary step is needed for these XML based 
"template languages".

>
>
> But, as Gregor already mentioned, we shouldn't drop the task concept but
> rather add an adapter to call them from a usecase handler.


well, I guess this has nothing to do with each other and can be done anyway.

Michi

>
> -- Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
>
>


-- 
Michael Wechner
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: tasks vs usecases

Posted by Jean Pierre LeJacq <jp...@quoininc.com>.
On Tue, 4 Jan 2005, Gregor J. Rothfuss wrote:

> Andreas Hartmann wrote:
>
> > In the future, I would discourage the usage of Ant for CMS functions.
> > I agree that invoking Ant might be useful in certain situations
> > (e.g., to trigger an existing Ant process), but that would require
> > only a small Ant wrapper which could be implemented easily using the
> > existing AntTask code.
> >
> > But, as Gregor already mentioned, we shouldn't drop the task concept but
> > rather add an adapter to call them from a usecase handler.
>
> i agree with andreas here. while we initially thought that ant targets
> could provide an easy way to customize lenya, it turns out that almost
> all of our current ant targets invoke ant tasks.
>
> therefore the alleged ease of writing ant targets is an illusion.
> combined with the problems of the ant approach, i don't think we should
> continue to support them.

+1

-- 
JP



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: tasks vs usecases

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Andreas Hartmann wrote:

> In the future, I would discourage the usage of Ant for CMS functions.
> I agree that invoking Ant might be useful in certain situations
> (e.g., to trigger an existing Ant process), but that would require
> only a small Ant wrapper which could be implemented easily using the
> existing AntTask code.
> 
> But, as Gregor already mentioned, we shouldn't drop the task concept but
> rather add an adapter to call them from a usecase handler.

i agree with andreas here. while we initially thought that ant targets 
could provide an easy way to customize lenya, it turns out that almost 
all of our current ant targets invoke ant tasks.

therefore the alleged ease of writing ant targets is an illusion. 
combined with the problems of the ant approach, i don't think we should 
continue to support them.

-- 
Gregor J. Rothfuss
COO, Wyona       Content Management Solutions    http://wyona.com
Apache Lenya                              http://lenya.apache.org
gregor.rothfuss@wyona.com                       gregor@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: tasks vs usecases

Posted by Andreas Hartmann <an...@apache.org>.
Michael Wechner wrote:
> Gregor J. Rothfuss wrote:
> 
>> Andreas Hartmann wrote:
>>
>>> I'm not quite sure if we can get rid of the task concept.
>>> Tasks were introduced as an atomic unit of work which can
>>> be invoked from a GUI or as a scheduled job.
>>
>>
>>
>> tasks are quite useful, as you say. what i don't like are the ant 
>> tasks, because they add more levels of indirection and have very poor 
>> error handling.
> 
> 
> 
> agreed, but the reason we introduced ant tasks was because we thought 
> users don't have to learn or program something else, but rather can rely 
> on existing ant tasks and I still think this is a very important argument.
> 
> Instead of dropping ant tasks it might make sense to talk to the ant 
> community what the possibilities could be

Ant tasks turned out to add extra complexity to the architecture.
Another problem is the lack of error handling support.

In the future, I would discourage the usage of Ant for CMS functions.
I agree that invoking Ant might be useful in certain situations
(e.g., to trigger an existing Ant process), but that would require
only a small Ant wrapper which could be implemented easily using the
existing AntTask code.

But, as Gregor already mentioned, we shouldn't drop the task concept but
rather add an adapter to call them from a usecase handler.

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: tasks vs usecases

Posted by Michael Wechner <mi...@wyona.com>.
Gregor J. Rothfuss wrote:

> Andreas Hartmann wrote:
>
>> I'm not quite sure if we can get rid of the task concept.
>> Tasks were introduced as an atomic unit of work which can
>> be invoked from a GUI or as a scheduled job.
>
>
> tasks are quite useful, as you say. what i don't like are the ant 
> tasks, because they add more levels of indirection and have very poor 
> error handling.


agreed, but the reason we introduced ant tasks was because we thought 
users don't have to learn or program something else, but rather can rely 
on existing ant tasks and I still think this is a very important argument.

Instead of dropping ant tasks it might make sense to talk to the ant 
community what the possibilities could be

>
> that said, i am wondering if usecases cannot take on this role?


I don't think this actually will solve the problem, but rather just
moves it around.

Michi


-- 
Michael Wechner
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail:              dev-unsubscribe@lenya.apache.org
For additional commands, e-mail:            dev-help@lenya.apache.org
Apache Lenya Project                          http://lenya.apache.org


Re: tasks vs usecases

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Andreas Hartmann wrote:

> BTW, thank you very much for your efforts. Your code really gets
> it going, it looks like the framework is not that hard to use :)

no, thank you! your code finally allows us to move away from XSP and 
actions while making the architecture easier to understand.

after a short learning curve, i found the usecase framework a joy to 
work with, and once we figure out task integration, we are pretty much 
all set.

-- 
Gregor J. Rothfuss
COO, Wyona       Content Management Solutions    http://wyona.com
Apache Lenya                              http://lenya.apache.org
gregor.rothfuss@wyona.com                       gregor@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail:              dev-unsubscribe@lenya.apache.org
For additional commands, e-mail:            dev-help@lenya.apache.org
Apache Lenya Project                          http://lenya.apache.org


Re: tasks vs usecases

Posted by Andreas Hartmann <an...@apache.org>.
Gregor J. Rothfuss wrote:
> Andreas Hartmann wrote:
> 
>> I'm not quite sure if we can get rid of the task concept.
>> Tasks were introduced as an atomic unit of work which can
>> be invoked from a GUI or as a scheduled job.
> 
> 
> tasks are quite useful, as you say. what i don't like are the ant tasks, 
> because they add more levels of indirection and have very poor error 
> handling.
> 
> that said, i am wondering if usecases cannot take on this role?

Yes, in most cases where no scheduling is necessary the usecase
framework will be sufficient.

[...]

>>> a first step would be to have some adapter to access the tasks from a 
>>> usecase.
>>
>>
>> Shouldn't be that hard. Maybe something similar to the
>> o.a.l.cms.cocoon.task.CocoonTaskWrapper.
> 
> 
> right. would you mind taking a stab at this? i am not very familiar with 
> the task internals.

I'll look at it when I find the time.

BTW, thank you very much for your efforts. Your code really gets
it going, it looks like the framework is not that hard to use :)

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail:              dev-unsubscribe@lenya.apache.org
For additional commands, e-mail:            dev-help@lenya.apache.org
Apache Lenya Project                          http://lenya.apache.org


Re: tasks vs usecases

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Andreas Hartmann wrote:

> I'm not quite sure if we can get rid of the task concept.
> Tasks were introduced as an atomic unit of work which can
> be invoked from a GUI or as a scheduled job.

tasks are quite useful, as you say. what i don't like are the ant tasks, 
because they add more levels of indirection and have very poor error 
handling.

that said, i am wondering if usecases cannot take on this role?

> My experiences showed that the need for being scheduled
> is restricted to a very limited number of task (usually publish
> and deactivate). We should consider to drop the general
> "schedulable" feature of tasks and concentrate on a framework
> for easily developing GUI-controlled usecases instead.

which we now have :)

>> a first step would be to have some adapter to access the tasks from a 
>> usecase.
> 
> Shouldn't be that hard. Maybe something similar to the
> o.a.l.cms.cocoon.task.CocoonTaskWrapper.

right. would you mind taking a stab at this? i am not very familiar with 
the task internals.

>> a second step would be to eliminate the ant build files and make the 
>> adapter responsible for injecting the right parameters into the tasks. 
>> a third step would be to replace the tasks with facades that use the 
>> repository api (once it is in place)
> 
> 
> I agree. All general functionality should be provided by the
> core. A lot of task code can be transfered to site management
> and repository handling classes.

+1

-- 
Gregor J. Rothfuss
COO, Wyona       Content Management Solutions    http://wyona.com
Apache Lenya                              http://lenya.apache.org
gregor.rothfuss@wyona.com                       gregor@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail:              dev-unsubscribe@lenya.apache.org
For additional commands, e-mail:            dev-help@lenya.apache.org
Apache Lenya Project                          http://lenya.apache.org


Re: tasks vs usecases

Posted by Andreas Hartmann <an...@apache.org>.
Gregor J. Rothfuss wrote:
> Gregor J. Rothfuss wrote:
> 
>> it seems to me that we can replace the ant tasks in lenya that are 
>> used as "backends" for most of our usecases today with proper usecase 
>> classes that do extend AbstractUsecase or DocumentUsecase.
> 
> 
> while i still think replacing the ant tasks is the right way to go, i 
> took a look at the number of ant tasks in use and their dependencies, 
> and it seems wise to do the refactoring in several stages.

I'm not quite sure if we can get rid of the task concept.
Tasks were introduced as an atomic unit of work which can
be invoked from a GUI or as a scheduled job.

Typically, a task used to be the last step invoked from a
usecase.

IMO a major problem about tasks is that they violate the
"simple things easy, complex things possible" principle.
All tasks have to be parameterized with strings, so the
usecase is responsible for gathering parameters and finally
execute the task. This turned out to be inappropriate for
complex usecases with a lot of user interaction.

Another drawback is the precondition checking. You had
to implement it once in the GUI (to show error messages)
and a second time in the task itself (to prevent it from
being executed as a scheduled job).

My experiences showed that the need for being scheduled
is restricted to a very limited number of task (usually publish
and deactivate). We should consider to drop the general
"schedulable" feature of tasks and concentrate on a framework
for easily developing GUI-controlled usecases instead.

> a first step would be to have some adapter to access the tasks from a 
> usecase.

Shouldn't be that hard. Maybe something similar to the
o.a.l.cms.cocoon.task.CocoonTaskWrapper.

> a second step would be to eliminate the ant build files and 
> make the adapter responsible for injecting the right parameters into the 
> tasks. a third step would be to replace the tasks with facades that use 
> the repository api (once it is in place)

I agree. All general functionality should be provided by the
core. A lot of task code can be transfered to site management
and repository handling classes.

-- Andreas




---------------------------------------------------------------------
To unsubscribe, e-mail:              dev-unsubscribe@lenya.apache.org
For additional commands, e-mail:            dev-help@lenya.apache.org
Apache Lenya Project                          http://lenya.apache.org


Re: tasks vs usecases

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Gregor J. Rothfuss wrote:
> it seems to me that we can replace the ant tasks in lenya that are used 
> as "backends" for most of our usecases today with proper usecase classes 
> that do extend AbstractUsecase or DocumentUsecase.

while i still think replacing the ant tasks is the right way to go, i 
took a look at the number of ant tasks in use and their dependencies, 
and it seems wise to do the refactoring in several stages.

a first step would be to have some adapter to access the tasks from a 
usecase. a second step would be to eliminate the ant build files and 
make the adapter responsible for injecting the right parameters into the 
tasks. a third step would be to replace the tasks with facades that use 
the repository api (once it is in place)

-- 
Gregor J. Rothfuss
COO, Wyona       Content Management Solutions    http://wyona.com
Apache Lenya                              http://lenya.apache.org
gregor.rothfuss@wyona.com                       gregor@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail:              dev-unsubscribe@lenya.apache.org
For additional commands, e-mail:            dev-help@lenya.apache.org
Apache Lenya Project                          http://lenya.apache.org