What is the state machine? and when need to use this? and what is the difference between flowchart, sequence and state machine?