Technical description
To implement this Design Pattern, we need to add a field to the table that describes the state. The field is either of the Boolean or Option type. The combination of the field name and the option values define metadata in context with the business logic, which we will create while writing the code.
Note
Using other field types, such as Text or Decimal would multiply the amount of states, making it impossible to code against.
When using the Boolean datatype, the record in the table the name of the field is the only element that we can use. The record either has the state (the value is yes
) or it doesn't (the value is no
).
Note
The video at https://www.youtube.com/watch?v=O2R-fTSup1o&list=PLhZ3P-LY7CqmVszuvtJLujFyHpsVN0U_w&index=16 explains the implementation of the Entity State Pattern.
When using the option field, the state can have multiple values. The combination of the field name, and the option values allow a more complex array of states....