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