Models with a finite number of states can be called Mealy models. In Mealy models, outputs are associated with transitions. There is the alternative model called as a Moore model, and in it the outputs are associated with states. The Moore model can be easily generated from the Mealy model, through replacing each output code associated with a transition with a corresponding output state. Output states are usually defined by a thick border or a double border. In the figure below, you can see the transition that was replaced with an additional state, the output state in which the output action occurs. Note that it was necessary to add a dummy output (empty) to indicate that the transition to the next state will occur without an additional external input.
The reasons why the Mealy models are preferable:
- They contain fewer states and, therefore, their model is simpler. The complexity of a model is determined by multiplying the number of input symbols by the number of states. As the number of states increases, you increase the size of the model and complicate its testing.
- They have stable states. The Moore’s model always contains changing states that will not wait patiently for us to check them. This increases the complexity of testing. In the Mealy model, you do not change the state until there is an input. In fairness, it should be noted that the Mealy model can also contain changing states if we allow an empty input, but in the Mealy model, there are usually fewer such states.
- They are closer to the implementation end. Programmers, implementing systems with a finite number of states, usually do this on the basis of the Mealy models, rather than the Moore models. The differences between the test and design models are a source of test design errors.
- They provide a repeatable output. A specific output (for example, OPEN FILE) can correspond to many different transitions. This could require a separate state for each case and, therefore, would lead to an increase in the size of the model.
- Their table presentation is simpler. The representation of a model with a finite number of states by a table is simpler with the Mealy model than with the Moore model.
These two models are theoretically equivalent. Each Moore model has a corresponding Mealy model and vice versa. Why then do we need these movements? According to observations, finite state models are used in design, for example, in the object-oriented approach, the Moore model is more often used than the Mealy model. You should not mix two types of models. Choose one of them (it is highly recommended to favor the Mealy model) and stick with it.
If you want to improve product quality, reduce investment in infrastructure, derisk deadlines speed up time to market, you are recommended to resort to testing projects outsourcing.
Add Comment