3 ms·
Sequence diagrams and state machines should be probably taught much better in CS courses. You generally see state machines in a theoretical course and things li
by zitterbewegung 3y ago
Sequence diagrams and state machines should be probably taught much better in CS courses. You generally see state machines in a theoretical course and things like sequence diagrams in an object oriented course.
What we should do is probably in your advanced data structure programming course that everyone has to take is to create a model of an elevator and diagram the behavior using a sequence diagrams. This would be achieved by using an associative array AKA a map [1] that would represent where the elevator is and what it has to do next (current state and next state based on input).
If you program this correctly it gets around using unit testing even because you have diagramed and all parts of the system are known and can just be gone through and that would be a sufficient test. An example of a library that implements this is at https://pypi.org/project/python-statemachine/ https://pypi.org/project/python-statemachine/
[1] https://en.wikipedia.org/wiki/Associative_array https://en.wikipedia.org/wiki/Associative_array