Implementing statecharts using Java enums

Jauhar Ali · 2010

Statechart, which is one of the important diagrams in Unified Modeling Language (UML), represents reactive behavior of a class of objects. Implementing statecharts has been difficult for programmers because the commonly used object-oriented programming languages do not support statecharts at the language level. In this study, we present a new approach to implement statecharts using Java enums. Each state is represented as an enum-value. The whole statechart behavior is encapsulated within the Statechart class. This class is nested inside the owner class of the statechart. The resulting code is object-oriented, efficient and well-structured.

Read the paper · More papers on PaperTik