Assume we are building a Progressive Web App(as everyone does these days) that communicates with the server through a rest API. Now I need to show a list of world countries to the user to choose from.
I have a table with valid world countries in the backend that I use to validate requests, but the problem is, it seems a waste of bandwidth to fetch a list of say 240 countries from the backend every time the user is interacting with the country picker. Of course this would be necessary if data changed frequently, but countries in the world don't change that often. Storing the list as a JSON in the frontend too has its own problem, what should I do if the list changes? Push an update to all clients? (considering the app may be turned into a REAL app with electron or Cordova and users don't like updates)
Now world countries are just an example and the cost of the request to the server can be much higher, for example, if I want to draw growth charts for a child I need 1MB of reference data and getting all that from the server every time is not ideal.
To summarize:
- If I store rarely updated data in the backend, I will waste bandwidth with every call to that data.
- If I store rarely updated data in the frontend(Client), I will have to push an update if the data ever changes and users will hate it.
users don't like updates
. Just for the record. It's August 2021 and users are already used to updates! They are updating apps all the time on their phones. As for Electron, it's JS, could not be easier to pull updates asynchronously and do hot deploys for irrelevant things such as a list of countries. The key is making updating policies user-friendly. For example, do not force them. Don't stop the app. A simple banner informing of newer versions or asking to restart now or later is something we all already got used to.