Statecharts: A visual formalism for complex systems [pdf]
pdf.sciencedirectassets.com
pdf.sciencedirectassets.com
Many of the ideas carried over to UML, and statecharts are used in many areas of software and hardware engineering today. They're useful in many different aspects of modern development (especially in user interfaces) because they strongly encourage the developer to explicitly model the "finite states" of an application, instead of writing ad-hoc logic everywhere in a haphazard way.
Like any technology choice, statecharts shouldn't be used for everything, and should be used when modeling complex application logic with (potentially hierarchical/orthogonal) finite states is appropriate.
Excellent guide to statecharts: https://statecharts.github.io Community: https://spectrum.chat/statecharts Documentation for XState: https://xstate.js.org/docs/
"Constructing the User Interface with Statecharts" https://www.amazon.com/Constructing-User-Interface-Statechar...
I've always wondered if statcharts were a powerful enough abstraction to handle everything I needed, and would like to read more about its specific application to implementing UIs. Does anyone have any other references, books, etc?
Here is an article by the author of this library with some justification for the appropriateness of statecharts in UI construction: https://dev.to/davidkpiano/no-disabling-a-button-is-not-app-...
In regard to expressivity, specially compared with FSM, a thorough description can be find in the paper "On Visual Formalisms" [2]. I copy some points here for convenience:
...people working on the design of really complex systems have all but given up on the use of conventional FSMs and their state diagrams for several reasons
(1) State diagrams are “flat.” They provide no natural notion of depth, hierarchy, or modularity + orthogonality + broadcast communication.
(2) State diagrams are uneconomical when it comes to transitions [...] resulting in an unnecessary multitude of arrows.
(3) State diagrams are [...] infeasible: as the system under description grows linearly, the number of states grows exponentially.
(4) State diagrams are inherently sequential in nature and do not cater for concurrency in a natural way.
1: https://statecharts.github.io/state-machine-state-explosion....
2: http://www.dcs.ed.ac.uk/home/kxt/on_visual_formalisms.pdf
In any case, keep in mind that Turing machines are (extended) state machines (albeit with infinite memory) so the expressive power of state machine is at least anything computable (sequentially - turing machine is a model of sequential computation).
I also published an article on the subject on infoq: https://www.infoq.com/articles/robust-user-interfaces-with-s...
All of that may be useful to you, with the benefits that you won't have to make the examples, as I had to, to evaluate the applicability of the technique to UI implementation.
If there is anythign you do not understand let me know.
> (4) The future lies in visual languages and methodologies that, with appropriate structuring elements, can exploit all the obvious advantages of graphical man-machine interaction.
> As to thesis (4), we believe that before long scientists and engineers will be sitting in front of graphical workstations with large (blackboard size?) displays of fantastic resolution, carrying out their everyday technical and scientific chores.
> The ‘real’ description of the object is usually given in some textual, algebraic form, and the picture is there only to help see things better, and to assist in comprehending the complexity involved. Here we are suggesting that visual formalism should be the name of the game;
> Textual representations of these visual objects can be given, but they are the aids (e.g., for users lacking graphical equipment, or for applications requiring textual reports), and not the other way around.
Yet, 33 years later we are nowhere close to the man-machine interaction the authors were suggesting.
Also, in early 2000, there was a movement for "executable UML", (https://en.wikipedia.org/wiki/Executable_UML). Which was based on state charts, and tried to be the first version of what is today known as "no code".
However, then agile came alone, and we went back to "code is the design", so those methods did not find commercial success.
We managed to model a significant part of the demo plant, the vessels and valves and such, not any software, but failed with an attempt of verification of properties with temporal logic and theorem provers.
The language was intended as an intermediate representation for a visual front-end for a full-cycle CASE system that would support multiple "views" of related abstractions (e.g., how analysis-level models related to production code-level models, and maintaining consistency among changes to any of them). I never built that CASE system, because I got even more interested in another area.
At the time, I had already worked heavily on production cross-platform multithreading in C++, but Java was so much easier and safer. (Also, the Java was very hot at the time, and with good reason.)
Today, I know Scheme well, and a separately-compiled DSL, for what could instead be a much more elegant and powerful mix of normal Scheme and syntax extension, seems silly.