Angular

Last Updated: 9/7/2023

Optimistic vs Pessimistic

  • Optimistic: Hopeful or positive
  • Pessimistic: Hopeless or negative
  • Pessimistic: Assuming the call to the server might fail, we only add the item to the list if we get successful response from the server
  • Optimistic: Instead of waiting to get the result from server we update the UI immediately, we assume most of the time the call to the server is going to succeed, if that fails for any reason, we are going to roll back the changes
  • Modern applications use the optimistic approach because it makes the application appear faster and smoother