9. Prototype
Letting an object copy itself, because it is the only thing that knows what it is made of
Duplicator makes a copy of a sheet, cell by cell. The tests pass, and the copy really is independent of the original.
It does it by reading the sheet’s cells out and writing them into a new one — which means Duplicator has its own idea of what a sheet is made of, kept in step with Sheet by hand.
Sheet already has copy(). Rewrite duplicate() to use it.
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
Run the tests to see where you are.