Internet magazine
Petr Bucek -
FSA (Finite-state automaton)
For ilustraion of my model-driven engineering. e.g. to analysis to
MemReader
After a click on File / Save in menu is diagram saved into actualized
file BookStore12.dia here are the objects of diagram persist.
This sample
file BookStore12.dia is here downloadable to compare with its graphical representation in diagram.
Analogically to recursive transition networks - UML FSA consists of nodes (states) and labeled arcs (transitions).
The
start node is initial state - represents the first state in the
process. It appears as a dark circle with an arrow leading from it.
The
state machine in Fig. 1 models a simple online book store. Simply
spoken, the user of this book store can browse over the books (state
Browse),
select a book (event book) and view either its summary (BookSummary) or detail infor-
mation (BookDetail), and, after successfully logging in (Login), buy the book (Buy).
However, modularization in state machine models is generally difficult, see [21].
In particular, even this simple state machine containing only seven states shows some
modularity deficiencies. This is also why Fig. 1 is not very easy to comprehend. In
particular, the following features complicate the state machine and obscure (at least
partially) the behavior of the web application:
1. In this application, the user can go back to the home of the application from every
other site. This is modeled by a transition leaving every other state to Home. This
is a violation of the Don’t Repeat Yourself (DRY) principle.
2. In order for the user to buy a book, he is required to be logged in. Since there
are two ways of entering Buy (from BookDetail and BookSummary), Login is also
modeled twice. Again, the DRY principle is violated.
3. When the user finishes browsing and selects a book (event book), it is difficult to
see which view, BookDetail or BookSummary is shown. In fact, two features are
modeled in a tightly entangled way:
(a) The system checks whether the summary or the detail view is more “com-
mercially successful” and shows the user this view. That is, it stores in the
two variables d and s (updated on the transitions leaving BookDetail and
BookSummary) the frequencies of the user proceeding to buy the book from
these views, and shows him the “right” view when the user has selected a book.
(b) Meanwhile, the systems also checks if it is technically appropriate to show the
detail view. Reasons for this view being inappropriate could be that the client
device, due to factors like processing power, band width, or size of the display,
does not support the display of the detail information. The detail of this check
is modeled in a rather abstract function call detailsOK(). Only then this function
returns true, the detail view is shown, otherwise the summary is shown instead.
4. The relation of the above two features is not easy to comprehend. Only after careful
study of Fig. 1 is it clear that currently an AND relation is implemented, that is, both
of the conditions must be satisfied for the book detail to be shown. Changing to OR
or any other combination (e.g. the detail view should be shown as soon as it is more
successful, no matter if the client is adequate or not) would be an error-prone task.
Such modularity problems of UML state machines can be addressed by HILA. In
the following, we first give a brief overview of HILA and then show how it can be used
in modeling web applications to improve the model modularity.