All jobs / Mobile developer / Networking
Mobile developer interview question · 1–3 years
How do you avoid re-downloading a list that rarely changes, without showing stale data for ever?
The strongest answer
The server sends a validator such as an ETag; the client sends it back and a 304 means reuse what it already has. A max-age says how long it may skip asking at all
Why it works
Right — validation keeps the round trip but drops the payload, and freshness is a server decision you honour.
What a good answer covers
- Validate instead of re-downloading.
- Store the validator with the response.
- A 304 means reuse what you have.
- max-age decides when to ask again.
Answers that fall short
- Close, but not the strongest: Cache the response for a few minutes and re-fetch once that time is up
That is the freshness half. Add validation, or every expiry re-downloads a body that has not changed. - Weak: Add a changing timestamp to the URL so the response is always fresh
A changing URL defeats caching entirely — that is the opposite of the goal, and it costs data on every open. - Red flag: Cache it for ever and add a hidden gesture that clears the cache when support tells the user to
Caching for ever with a secret escape hatch means support has to talk each affected user through a workaround.
Who gets asked this
More Networking questions
- You are choosing how a field-sales app syncs. What do you put in the design doc?
- On launch the app fires six requests at once. The access token has expired, and some users end up logged out…
- Three apps will all work offline. What do you standardise?
- The API was down for ten minutes. It fell over again the moment it returned, and the traffic was the app…
- The backend adds a field to a response and the shipped app starts failing to parse it. What should the client…
- A feed can be tens of thousands of items. How do you load it?
- A notes app edits offline and later meets a server that also changed. What do you do?