honeytrap.devexercisesobserver.javaSettings
Description

21. Observer

EasyBehavioural1 hidden requirement

Keeping subscribers in a collection, so who is listening is decided at runtime

Ticker publishes a price and its two subscribers react. The tests pass, and remove() works.

It has a field for each of them, by concrete type. So the set of possible subscribers is fixed at compile time, and a third one has nowhere to go.

Every subscriber implements Listener. Rewrite Ticker to keep them in a list.

Read the article →

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