We need exactly one. So Singleton?
transcript
We need exactly one config. So it should be a Singleton. Right? Not so fast. Needing one is not the same as a Singleton.
Singleton is two ideas in one sentence. Exactly one instance. That's cheap. Make one object. And a global point of access. That's where the costs live.
The dependency is hidden. It's in no signature. State is shared. Every test and every caller. And a fake means a reset hook, just for tests.
Main creates one config, at start-up. It hands the same config to the checkout, and the report job. One config. No class had to enforce it.
In a test, build a different config. Nothing is shared, so nothing leaks. No reset hook needed. And the config can be immutable, so nobody changes it by accident.
Needing one is a fact about wiring. Create it once. Pass it in. You keep the one instance, and drop the global.
Full breakdown in the lecture.