Too Long; Didn't Read
TypeState pattern is a generic pattern that could be used in multiple languages. I encountered this pattern first while developing software using Rust in Python. The basic idea behind TypeState Pattern is to encode the state information inside types. The connection can exist in two states: the connection to remote end has not been established, and the connection between remote and remote ends has been established. The following shows an approach to implement a similar logic without using the pattern, by maintaining the state info inside an attribute.
Share Your Thoughts