Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
titleDescription
Quote External
source-urihttp://sourcemaking.com/design_patterns/template_method
render-anonymousfalse
sourcehttp://sourcemaking.com/design_patterns/template_method

The Template Method defines a skeleton of an algorithm in an operation, and defers some steps to subclasses.

We achieve that by defining the skeleton of the checking algorithm in one operation, deferring the specific checking algorithm steps to subclasses.

 

The invariant steps are implemented in the abstract base class, while the variant checking algorithms have to be provided by the subclasses.

Code Block
languagejava
/**
 * template method for performing a single type of checks
 * on the given @see HtmlPage.
 *
 * Prerequisite: pageToCheck has been successfully parsed,
 * prior to constructing this Checker instance.
 */
 public CheckingResultsCollector performCheck() {
    // assert prerequisite
    assert pageToCheck != null
    initResults()
    return check() // execute the actual checking algorithm
 }
Transclusion
taget-heading-level2
documentTemplate Method
idsContext, Elements

Content Marker
idContent
Section
titleMotivation
Section
level2
titleQuality Scenarios
Display Table
doctypequality-scenario
render-no-hits-as-blanktrue
selectName, Short Description
restrict-to-immediate-childrentrue
empty-as-nonetrue
Section
level2
titleUse Cases
Display Table
doctypeuse-case
render-no-hits-as-blanktrue
selectName, Short Description
sort-bySort Key, Name
restrict-to-immediate-childrentrue
empty-as-nonetrue
Section
titleSolution
Section
level2
titleConstraints
Display Table
doctypeproject-constraint
render-no-hits-as-blanktrue
selectName, Short Description
sort-bySort Key, Name
restrict-to-immediate-childrentrue
empty-as-nonetrue
Section
level2
titleDecisions
Display Table
doctypearchitecture-decision
render-no-hits-as-blanktrue
selectName, Short Description
sort-bySort Key, Name
restrict-to-immediate-childrentrue
empty-as-nonetrue
Section
titleApplication

Section
titleDiscussion

...