Лекция: State-Based Object-Oriented Programming
The composite approach may be rather useful for solving task from a very large spectrum, it is based on object-oriented and automata-based programming paradigms. In work this method was called as “state-based object-oriented programming”. Feature of this approach is that, like in Turing machines, here controlling (automata) states are explicitly singled out. The amount of these states is noticeably fewer than amount of all other objects states (for example, run-time states).The term “states space” was introduced in programming. This term means the set of object controlling states.
So this approach provides more understandable behavior in comparison with case when such space is absent. The minimal set of documents, which are necessary for the visually and clearly, but strictly describe structural (static) and behavioral (dynamic) sides of the software. As when using any other approach, this approach needs the set of heuristics, back-steps, accurate definitions and concurrent tasks. But after program has been developed offered approach may be named an ideal technology for storing of decisions which had been made. After analysis of the knowledge domain the classes could be defined and class diagram may be drawn up. For each class the verbal description needs to be created at least in the form of list of tasks to be solved. For each class the structure scheme is to be developed. This scheme describes its interface and structure. Important note is that classes attributes and member functions are to be separated to automaton and others.
If there are several automata in the same class then there is a need in drawing up their interaction scheme. For each automaton verbal definition is to be developed with the bond scheme and state transition graph. Each class implemented with the separate program module. Its structure is isomorphic to classes structure. Member functions, which have corresponding automata, are realizable according to the template, described in paper . For system debugging and for confirmation of propriety of its work protocols are automatically built during run-time. These protocols describe the functioning of objects, which contains automata, in terms of states, transitions, events, input and output actions. Project documentation is to be made. Its important part is the program documentation. From stated above it can concluded that application of automata makes programs behavior clearer as objects using makes programs structure clearer. Described approach was used for developing tank controlling system for “Robocode” system. In contrast to controlling systems of hundreds of other tanks, there is a detailed project documentationfor this tank. Documentation contains state transition graphs, bond schemes and others. Detailed protocols of tanks behavior allow to observe the history of battle. Method of protocols drawing up may form a base of new paradigm of blackbox functioning. In the described technology automata were implemented inside classes’ member functions. But there could be another approaches to the object realization of automata, which were described. Automata may stand out, in particular, and classes, which are descendants of the class that realizes automata basic functionality. This functionality is declared by the semantics of Switch-technology.
It is also possible to use classes, which realizes concepts of “state” or “group of states”. For automata programs design pattern “state” or other patterns may be also used. Peculiarities of automata implementation of parallel processes, based on messages interchange, are considered in paper. Existence of high quality project documentation makes further program refactoring (changing of programs structure, keeping its functionality the same) much easier. Last thesiswas confirmed by refactoring of tank controlling system, which was mentioned above. Refactoring was complete for rising programs “objectness”.