Multiple ChoiceIntermediate 45s
Decorator ordering matters
Wrap an HTTP client with Retry and Auth decorators. Why can ordering change behavior?
Options
- 1Order never matters for decorators because each one is always fully independent of all the others near it
- 2Because decorators are stateful singletons that are shared across all of the client's many outgoing calls
- 3Because each decorator sees a different view: e.g. retry wrapping auth re-authenticates each attempt, auth wrapping retry does not
- 4Because the compiler quietly sorts all the applied decorators alphabetically by their declared class names
Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.