Code Generation from UML State Chart Diagrams
Xingchan Li, Xinquan Wu · 2022
Event-driven systems can be modeled and implemented by Unified Modeling Language (UML) state chart. However, with the increase of complexity of the state chart diagram has a serious effect on code generation and code coupling. This paper presents a pattern-based approach to generate code from the UML state chart diagram. Firstly, a novel design pattern is exploited for the implementation of the state diagram which includes hierarchical, concurrent, and history states. The proposed pattern is an extension of state pattern by using the concept of object composition and delegation. Secondly, the mapping rules are defined for correspondence to the new pattern. Then, the code templates are customized by complying with the mapping rules. Finally, The effectiveness of the method proposed in this paper is analyzed based on the case of a microwave oven control system.