You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Jörn Nettingsmeier <po...@uni-duisburg.de> on 2006/06/09 13:58:22 UTC
AbstractUsecase: what are the doFoo(() methods for?
hi everyone!
just a quick question: in AbstractUsecase.java, most methods exist as
someAction() with actual code in them, and there is also a method
doSomeAction. why is that? and how come those doSomeAction methods do
not call the SomeAction ones? can anyone explain?
thanks,
jörn
--
"Open source takes the bullshit out of software."
- Charles Ferguson on TechnologyReview.com
--
Jörn Nettingsmeier, EDV-Administrator
Institut für Politikwissenschaft
Universität Duisburg-Essen, Standort Duisburg
Mail: pol-admin@uni-due.de, Telefon: 0203/379-2736
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: AbstractUsecase: what are the doFoo(() methods for?
Posted by Jörn Nettingsmeier <po...@uni-duisburg.de>.
Andreas Hartmann wrote:
> Jörn Nettingsmeier wrote:
>> hi everyone!
>>
>>
>> just a quick question: in AbstractUsecase.java, most methods exist as
>> someAction() with actual code in them, and there is also a method
>> doSomeAction. why is that? and how come those doSomeAction methods do
>> not call the SomeAction ones? can anyone explain?
>
> The doSomeAction() methods are template methods [1], [2].
>
> The AbstractUsecase.someAction() methods define the algorithm body,
> including error handling and other stuff. This behavior is considered
> universal, therefore the methods are declared final.
>
> The actual processing is delegated to the doSomeAction() methods.
> For more information visit the links below.
>
> BTW, if you wonder why it is harmful to just call super.someAction(),
> refer to [3]. There's also a very appropriate example with the same
> naming convention (handle(), doHandle()).
>
>
> [1] http://c2.com/cgi/wiki?TemplateMethodPattern
> [2] http://en.wikipedia.org/wiki/Template_method_pattern
> [3] http://www.martinfowler.com/bliki/CallSuper.html
ah. thanks for those pointers, very instructive. once you dig the
concept, everything just falls into place. nice.
--
"Open source takes the bullshit out of software."
- Charles Ferguson on TechnologyReview.com
--
Jörn Nettingsmeier, EDV-Administrator
Institut für Politikwissenschaft
Universität Duisburg-Essen, Standort Duisburg
Mail: pol-admin@uni-due.de, Telefon: 0203/379-2736
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: AbstractUsecase: what are the doFoo(() methods for?
Posted by Andreas Hartmann <an...@apache.org>.
Jörn Nettingsmeier wrote:
> hi everyone!
>
>
> just a quick question: in AbstractUsecase.java, most methods exist as
> someAction() with actual code in them, and there is also a method
> doSomeAction. why is that? and how come those doSomeAction methods do
> not call the SomeAction ones? can anyone explain?
The doSomeAction() methods are template methods [1], [2].
The AbstractUsecase.someAction() methods define the algorithm body,
including error handling and other stuff. This behavior is considered
universal, therefore the methods are declared final.
The actual processing is delegated to the doSomeAction() methods.
For more information visit the links below.
BTW, if you wonder why it is harmful to just call super.someAction(),
refer to [3]. There's also a very appropriate example with the same
naming convention (handle(), doHandle()).
[1] http://c2.com/cgi/wiki?TemplateMethodPattern
[2] http://en.wikipedia.org/wiki/Template_method_pattern
[3] http://www.martinfowler.com/bliki/CallSuper.html
HTH,
-- Andreas
--
Andreas Hartmann
Wyona Inc. - Open Source Content Management - Apache Lenya
http://www.wyona.com http://lenya.apache.org
andreas.hartmann@wyona.com andreas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org