A Framework for UML-Based Component-Based Design and Code Generation for Reactive Systems
Abstract
One way to design complex systems is to use an event-driven architecture. Model Driven Engineering (MDE) promotes the use of different abstract concepts, among which are the UML state machine, composite structure elements and their associated visualizations, as a powerful means to design such an architecture. MDE seeks to increase software productivity by automatically generating executable code from state machines and composite structures. To this end, a code generation approach in MDE should support all model elements used at the design level. However, existing code generation approaches and tools are still limited, especially when considering concurrency, event types, and pseudo states such as history and junction. Furthermore, in the literature, the combination of component-based design and UML state machines is supported by only a few existing approaches. This paper explores this combination and provides code generation patterns and framework-based tooling support for the combination and complete and efficient code generation from UML state machines. We extend a well-known state machine code generation pattern with concurrency support. In order to verify the semantics of generated code, we execute code generated by the proposed framework with a set of state-machine examples that are part of a test-suite described in the recent OMG standard Precise Semantics Of State Machine. The traced execution results comply with the standard and are a good hint that the execution is semantically correct. Regarding code efficiency, the code generated by our approach supports multi-thread-based concurrency, and the size of the generated code is smaller compared to considered approaches. Moreover, we demonstrate the practicality, feasibility, and scalability of the proposed approach with two case studies.