Singleton
medium 60 minOne object and one way to reach it.
Watch lesson4:52
What each level should show
The same question is judged differently for mid, senior and staff.
Junior
Must show
- Names the three parts
- Writes a working lazy version
- Knows that per-user data does not belong in it
Will be probed on
- What if two threads call it?
- Static class or Singleton?
Stands out
Finds the race without being asked.
Mid
Must show
- Explains both checks
- Knows volatile, holder, enum or static local
- Shows the test problem and the injection
Will be probed on
- Unfinished object
- Python's __init__
- Eager or lazy
Stands out
Says one per what.
Senior
Must show
- Explains visibility, not only locking
- Handles failure at start and live changes
- Counts instances across processes
Will be probed on
- Serialization, loaders, fork
- Initializer that throws
- Snapshot swap
Stands out
Separates one instance from global access.
Staff
Must show
- Plans lifecycle and shutdown order
- Moves a large program to injection in safe steps
- Uses leases with fencing for single jobs
Will be probed on
- Connection budget
- Scopes that do not fit
- Destruction order
Stands out
Removes the need for it, and can say what it costs to do so.