11. Bridge
Letting two things vary independently, by giving each its own axis
Picture draws its shapes, and the tests pass.
It does the drawing itself, deciding first what shape it has and then what renderer — so it holds one branch for every combination of the two, and adding either kind means editing here.
Shape already has drawWith(renderer), and every shape implements it. Rewrite draw() so Picture handles neither axis.
There are two change requests on this one, applied separately. That is not two ideas: varying on two axes at once is the idea, and one of them alone would not show it.
Run compiles every file and runs Tests.java — the tests you can read.
Submit runs those again, then applies 2 requirements 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
Run the tests to see where you are.