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
[EMAIL PROTECTED] [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]