Synopsis:
Practical UML Statecharts in C/C++ Second Edition bridges the gap between high-level abstract concepts of the Unified Modeling Language (UML) and the actual programming aspects of modern hierarchical state machines (UML statecharts). The book describes a lightweight, open source, active object (actor) framework, called QP that enables direct manual coding UML statecharts and concurrent event-driven applications in C or C++.
This book is presented in two parts. In Part I, you get a practical description of the relevant state machine concepts starting from traditional finite state automata to modern UML state machines followed by state machine coding techniques and state-machine design patterns, all illustrated with executable examples. In Part II, you find a detailed design study of a generic real-time framework indispensable for combining concurrent, event-driven state machines into robust applications. Part II begins with a clear explanation of the key event-driven programming concepts such as inversion of control (”Hollywood Principle”), blocking versus non-blocking code, run-to-completion (RTC) execution semantics, the importance of event queues, dealing with time, and the role of state machines to maintain the context from one event to the next. This background is designed to help software developers in making the transition from the traditional sequential to the modern event-driven programming, which can be one of the trickiest paradigm shifts.
The lightweight QP active object framework goes several steps beyond the traditional real-time operating system (RTOS). In the simplest configuration, QP runs on bare-metal microcontroller completely replacing the RTOS. QP can also work with almost any OS/RTOS to take advantage of the existing device drivers, communication stacks, and other middleware.
The accompanying website to this book (state-machine.com/psicc2) contains complete open source code for QP and the free QM graphical modeling tool for QP, ports to popular processors, including ARM Cortex-M, ARM7/9, MSP430, AVR/AVR32, PIC24, RX, etc., as well as QP ports to operating systems, such as Linux, Windows, and Android.
From the Author:
The embedded software industry is in the midst of a major revolution. Tremendous amount of new development lays ahead. This new software needs an actual architecture that is inherently safer, more extensible, and easier to understand than the usual shared-state concurrency and blocking based on a traditional Real-Time Operating System (RTOS).
This book provides and explains such a modern, event-driven architecture based on active objects (actors), hierarchical state machines, software tracing, graphical modeling and automatic code generation. While others only talk about these modern techniques, this book actually comes with practical, efficient, working software that has been battle-tested and proven in real-life systems.
Welcome to the 21st century!
"About this title" may belong to another edition of this title.