state-pattern

What is the difference between a state machine and the implementation of the state pattern?

亡梦爱人 提交于 2020-07-28 06:02:05
问题 I wonder if a state machine is just the state pattern at work or if there is actually a difference between those two? I found this article with the bold title "the state design pattern vs state machine" but at the end of the day he only says that the state pattern makes state machines obsolete but then doesn't describe what exactly is a state machine compared to the implementation of the state pattern . 回答1: The way I describe this difference to my colleagues is that state patterns are a more

What is the difference between a state machine and the implementation of the state pattern?

久未见 提交于 2020-07-28 06:01:50
问题 I wonder if a state machine is just the state pattern at work or if there is actually a difference between those two? I found this article with the bold title "the state design pattern vs state machine" but at the end of the day he only says that the state pattern makes state machines obsolete but then doesn't describe what exactly is a state machine compared to the implementation of the state pattern . 回答1: The way I describe this difference to my colleagues is that state patterns are a more

State Pattern in Python

这一生的挚爱 提交于 2020-05-15 11:01:08
问题 I am having some issues wrapping my head around on implementing the state design pattern in Python. I am new to Python and wrote some code to try and answer this question that was presented to me: Write the code for a simple ATM that allows a user to insert their card, enter their PIN, request cash and eject card. Use the following object model for the system that shows the use of the State Pattern. You will need to figure what state to change to for each action. Please see the below UML

State Pattern in Python

£可爱£侵袭症+ 提交于 2020-05-15 11:00:13
问题 I am having some issues wrapping my head around on implementing the state design pattern in Python. I am new to Python and wrote some code to try and answer this question that was presented to me: Write the code for a simple ATM that allows a user to insert their card, enter their PIN, request cash and eject card. Use the following object model for the system that shows the use of the State Pattern. You will need to figure what state to change to for each action. Please see the below UML