A Comparative Study on State Programming: Hierarchical State Machine (HSM) Pattern and State Pattern

Ahmet Cuneyd Tantug, Özdemir Kavak · Lecture Notes on Software Engineering · 2014

State machines can be implemented by using several methods.Although state pattern (SP) implementation is one of the most popular methods, nowadays usage of hierarchical state machine (HSM) pattern is increasing.In this paper our motivation is making a metric based comparison between HSM and SP pattern.In addition, effect of increase in usage of inheritance in HSM pattern is analyzed.SP and HSM pattern belongs to different software methodologies, thus usage of object-oriented (OO) metrics is not applicable.However, both patterns implement state machines.For this reason, a new metric suit for state machines is proposed.As a result of this study, it is shown that using inheritance effectively in HSM pattern increases software quality.In addition, it is shown that HSM pattern handles enter/exit actions more effectively than SP.

Read the paper · More papers on PaperTik