STATE MACHINE DIAGRAM Tutorial 4 IT 323 Software

  • Slides: 23
Download presentation
STATE MACHINE DIAGRAM Tutorial 4 IT 323 - Software Engineering 2

STATE MACHINE DIAGRAM Tutorial 4 IT 323 - Software Engineering 2

Project Phase 2: https: //it 323 blog. files. wordpress. com/2016/01/guide-for-writing-a -system-design-document. docx

Project Phase 2: https: //it 323 blog. files. wordpress. com/2016/01/guide-for-writing-a -system-design-document. docx

The following state machine diagram is a sketch of some of the behaviors of

The following state machine diagram is a sketch of some of the behaviors of an i. Pod.

Q 1) Write down a sequence of events that will play a song (from

Q 1) Write down a sequence of events that will play a song (from the initial state).

A 1) Press any button; select song (this assumes that initially battery has power)

A 1) Press any button; select song (this assumes that initially battery has power)

Q 2) What is the shortest sequence of events needed to get back to

Q 2) What is the shortest sequence of events needed to get back to the playing state if the battery runs out.

A 2) Connect; disconnect; select song

A 2) Connect; disconnect; select song

Q 3) What is the shortest sequence of events needed to select a different

Q 3) What is the shortest sequence of events needed to select a different song while playing?

A 3) Connect; disconnect; select song (note: the model isn’t very accurate!)

A 3) Connect; disconnect; select song (note: the model isn’t very accurate!)

Q 4) For each of these properties, state whether the property is true or

Q 4) For each of these properties, state whether the property is true or false, and explain your reasoning: a- “The i. Pod remembers what song was playing when it is docked”

A 4 a) False – the only path from the docked state requires you

A 4 a) False – the only path from the docked state requires you to select a song

Q 4) For each of these properties, state whether the property is true or

Q 4) For each of these properties, state whether the property is true or false, and explain your reasoning: b- “The i. Pod remains in the sleep state if the battery dies”

A 4 b) False – the “battery=0%” returns the i. Pod to the Off

A 4 b) False – the “battery=0%” returns the i. Pod to the Off state from the sleep state.

Q 4) For each of these properties, state whether the property is true or

Q 4) For each of these properties, state whether the property is true or false, and explain your reasoning: c- “Sometimes you need to press play more than once to get it to play”

A 4 c)True – from the sleep state, you need to press play twice.

A 4 c)True – from the sleep state, you need to press play twice.

Q 4) For each of these properties, state whether the property is true or

Q 4) For each of these properties, state whether the property is true or false, and explain your reasoning: d- “There is no way to turn the i. Pod off other than running the battery down”

A 4 d) True – You need to generate a “battery=0%” event to get

A 4 d) True – You need to generate a “battery=0%” event to get back to the Off state

Q 5) What does the model say about what would happen if the battery

Q 5) What does the model say about what would happen if the battery dies while the i. Pod is docked?

A 5) It ignores this case. If the battery is dead when you disconnect,

A 5) It ignores this case. If the battery is dead when you disconnect, the model says you go to the menus state, and then to the Off state immediately, implying the menu shows, if briefly. This might be okay if docking always provides a minimal charge.

Q 6) When you first buy an i. Pod it has no songs on

Q 6) When you first buy an i. Pod it has no songs on it. How would you modify the model to include this situation?

A 6) Add another state distinct from “off” to indicate “empty”. The i. Pod

A 6) Add another state distinct from “off” to indicate “empty”. The i. Pod would start in this state, but would probably never return to it except perhaps for a factory reset. There would be no transition from the empty state to the menus state.

Group Work http: //business. salary. com/group-work/

Group Work http: //business. salary. com/group-work/

Thank You

Thank You