honeytrap.devexercisesvisitor.javaSettings
Description

25. Visitor

HardBehavioural1 hidden requirement

Putting a new operation over a tree in one new class, without touching the tree

Report works out what an expression tree comes to, and the tests pass.

It walks the tree itself, asking each node what type it is. It takes a Visitor and never calls it — so a second operation over the same tree means a second walker, with the same type checks written again.

Every node already implements accept(visitor), and Evaluator is already a Visitor. Rewrite run() so the tree does the walking and the visitor does the work.

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