An Object-Oriented Approach To Generate Java Code From UML Statecharts

Iftikhar Azim Niaz, Jiro Tanaka · 2005

The Unified Modeling Language (UML) statechart diagram is used for modeling the dynamic behavior of a system. This paper describes an object-oriented (OO) approach to generate compact and efficient Java code from UML statechart diagrams. The states are represented as objects and all the behavior associated with a state is contained in one object. This localizes the state-specific behavior and partitions behavior for different states. Introducing separate objects for different states makes the transitions more explicit. We have implemented the statechart diagram having sequential and concurrent substates by extending the state design pattern using the concept of object composition and delegation. The method has been successfully implemented in our automatic code generating system, JCode, which generates Java code after reading the specifications of the UML statechart diagram. The paper also presents the results of the experiment in which the code generated by JCode is compared to that of Rhapsody and OCode. The results show that the code generated by JCode is 68% more efficient and four times more compact than that of Rhapsody and 50% more efficient than that of OCode.

Read the paper · More papers on PaperTik