How do I reuse a state machine in a slightly different way?

Posted by JoJo on Programmers See other posts from Programmers or by JoJo
Published on 2012-07-06T20:11:31Z Indexed on 2012/07/06 21:24 UTC
Read the original article Hit count: 195

Problem

I have a big state machine. The design requirements of the project have changed such that I need to re-use this state machine in another place. All the states remain the same in this new place, but a few states run slightly different stuff. What design pattern allows me to reuse this state machine?

Motivation

I am building a video player. It is modeled by a state machine with these states: stopped, loading, playing, paused, crashed, and some more... This video player needs to be used on two web pages. When the player crashes on the first page, it should show an error message below. If the player crashes on the second page, the error message should appear in the center of the video and pulsate a few times.

© Programmers or respective owner

Related posts about design-patterns

Related posts about finite-state-machine