Abstract: Automata-based programming is often used for creating systems with the complex behavior. However the automata-based programming has problems such as support of automata-based code and documentation, further system improvements and code clarity. Object-automata approach is based on the object-oriented and the automata-based approaches and combines their main advantages, such as a flexibility, scalability and availability of a powerful mechanism for describing complex systems based on the finite state machines. This approach allows to resolve the problems described above.
In existing object-automata approaches it is hard to encapsulate the transition clauses and develop code that clearly reflects the transitions between states as the transition logic is often hidden in the handler methods of incoming actions. In order to resolve the problems of existing object-automata approaches and retain all their benefits it is suggested to use dynamic programming languages for creating automata programs. This paper describes two approaches based on object-automata approach that use object-oriented and dynamic Ruby properties.
This paper shows that using object-oriented features of Ruby each state and automata can be represented as a separate class. It helps to maintain the automata hierarchy in the object-oriented code. However this approach has disadvantages, such as syntax redundancy that complicates code modifications and improvements.
With the help of Ruby’s dynamic language features a domain-specific language (DSL) can be developed. The DSL will allow to an isomorphic translation of state charts to code and solve problems of pure object-oriented approach. However this approach has a disadvantage of losing the automata hierarchy because each state and automata are not represented as a separate class.