It’s so exciting to start connecting all the concepts together and consider how to program the whole application. I find it fun (also challenging) to shift from designing a state into coding a state. The way I understand today’s lecture—instead of using mathematical notions like unions and sets—is through the analogy of OOP (once again, similar to my blog on L5).

I sort of see the concept as a type of class that we are constructing. It acts both as a constructor and a “blueprint”. The states associated with this concept are thus almost like inherited classes, yet they are also part of what makes the concept a “class”. In other words, the concept is only valid with the presence of these children classes. To ensure that states are independent with each other, they are also their own class while sharing the same parent class with other states.

The actions, in my analogy, are like dunder methods in the concept class, yet they are not fully defined in this class unless more than one states use the same action. In terms of OOP, each action (dunder method) is then extended in the state class and fully defined there. They can be like “setter” and “getter” methods that affect each state. However, the constraints present in each state (invariants) prevent certain things from modified (such as a folder can’t contain itself or be moved into itself). On the other hand, two states’ actions can jointly affect another state, while the three states remain independent.