Apologies for the title, perhaps someone can suggest a better way to summarize my question.
Let's say I have a task/checklist application. On the front-end, I create a task. The eventual result is that the task exists in both the front-end and the database. I have these 2 approaches:
- I create a task in the front end by first sending a request to the backend, then awaiting for the request result. If the result is 200, then I go ahead and create the task in the front end. Now I have both the task in the front end (displayed to the user) and in the backend (saved).
- I create a task in the front end by first sending a request to the backed, then awaiting for the request result. The request then send back not only the status code, but the entire task object itself to the front end. I take the task object (deserialized) and display it to the user.
The considerations between the 2 are:
2I don't need to update the logic of creating the task in 2 locations (in the front-end to create and display and in the back-end to create and store) and there could be inconsistencies between what the user sees and what is stored if incorrectly created/updated.
1I have less network traffic. All the request needs to respond with is
200and not the entire task object.