honeytrap.devexercisestemplate-method.javaSettings
Description

24. Template Method

EasyBehavioural1 hidden requirement

Fixing the order of the steps in the base class and letting a subclass fill each one in

Importer.run() imports a file, and the tests pass.

It does all three steps itself, with the CSV versions written inline — so Importer, the general thing, is really the CSV importer with an abstract keyword on it.

CsvImporter already has read(), transform() and write(). Rewrite run() to be the skeleton: declare the three steps abstract and call them in order.

Close to Factory Method in shape. That one varies what gets created; this one varies a step in an algorithm whose order is fixed.

Run compiles every file and runs Tests.java — the tests you can read.

Submit runs those again, then applies 1 requirement you have not seen, one at a time.

Your code is never edited. Each requirement is added to the project as it stands. If the design is right, nothing you wrote has to change.

  • Ctrl/⌘ + Enter runs the tests