Sunday, March 15, 2020

data meaning: "status" vs. "state"


In program code and database it is very often needed to name variable or field
that describes current "state" or "status" of an object or a record. What is the correct name, though?
That depends on context, and the meaning is NOT exactly same, and it is not arbitrary. 
  • "state" is specific, where value can be one of pre-defined known distinct values, with conditions, like in context of "state machine", i.e. state of shopping cart: empty, open, closed etc.
  • "status" is broader and is a result of an action or activity, where it could indicate an error or also include resulting state, i.e. status of adding item to shopping cart error for insufficient funds. 
So simple rule for programming: when all possible values for an fields are known and defined better name  "state", and when all values are not known or defined that this is a "status". 


"systems engineering definition:
  • A system is in a certain "state" at a point in time when the system meets a pre-defined set of criterion, i.e. on shopping website, a user's shopping cart enters a different state when the customer adds an item to it.
  • A "status", in the context of states of a system, describes the transition into a state. For example, the user of our online shop may attempt to add an item to their cart. The transition into the state that describes the item being in the cart may be blocked if the status of the transition signals an error (i.e. the item is out of stock).
... state exists (or does not exist) irrespective of time. A status, however, describes the outcome of an action at a particular point in time."




React: Facebook Messenger: Project LightSpeed

Project LightSpeed: Rewriting Messenger to be faster, smaller, and simpler



Dan Abramov on Twitter: "What’s going on with React Native and Messenger? There’s many hot takes, but I’ll stick to my understanding of the facts. A thread so that I don’t have to copy and paste this in replies:" / Twitter