Architecture · interview question
If you wrote a test around caching, what should the test prove first?
Multiple choiceMediumchapter-18-curatedpremiumarchitecturecaching
cached = cache.get(order_id)
if cached is None:
cached = repo.by_id(order_id)
cache[order_id] = cachedAnswer and explanation
Correct answer
B. That the rule behaves correctly at the boundary cases the lesson is trying to make explicit.
Why
Good tests make the design safer to change because they lock in the meaningful behavior rather than surface-level implementation details.
Test yourself on Architecture
A free test with instant, explained results. No account needed.
More Architecture questions
- Which explanation would best help the team align on caching?
- A senior interviewer asks for one tradeoff behind environment-based deployment. What is the strongest follow-up?
- Another engineer will maintain this code later. What choice helps the most around caching?
- A teammate submits shaky idempotency code. Which review comment is the strongest?
- Which option is the safer default when shipping code around container and process shape?
- Which move is the best default when idempotency becomes part of this workflow?