Abstract

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. event e with the same transition a. Both states go to the same state; S3, with event e. S1 and S2 can be grouped under S12. By doing so, the number of events and transitions is reduced with the help of inheritance.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.