Questions tagged [finite-state-machine]
The finite-state-machine tag has no usage guidance.
132
questions
1
vote
1
answer
88
views
How to Handle Additional Parameters in State Transition for State Pattern in C++
I'm implementing a state pattern in C++ with a context and several states. Each state implements its transition. Here's a simplified version of what that design could look like:
class Context;
class ...
1
vote
2
answers
139
views
Pattern / Architecture to implement State Machine with "steps" between states
I'm looking for some guidance implementing the following problem:
We have a set of 'states' which a user can enter into:
1.- Registered: A user registers themselves in the system and can start placing ...
1
vote
2
answers
100
views
Deferring/Saving State/Events in UML Statecharts
I have been doing a lot of thinking lately about the implications of event-based/responsive programming and UML statecharts.
I believe my thinking up to this point has been flawed. Take, for example, ...
1
vote
1
answer
81
views
UML Statecharts - How to "remember" event parameters?
In UML statecharts, an event may how zero or more "parameters" (i.e., additional data associated with the event). The classic example would be a key press event with a parameter containing ...
1
vote
4
answers
199
views
Programming language independent semantic validation of message protocol
I have a proprietary protocol that describes the exchange of messages of two participants (applications) via a messaging broker (mqtt). A participant is of type A or B. Each type is allowed to send ...
0
votes
0
answers
189
views
How to implement state inheritance in C++ state machine framework
My first introduction to object-oriented UML statecharts was the book "Practical Statecharts in C/C++" by Miro Samek. He proposes a framework in which the state machine is a single class ...
1
vote
1
answer
201
views
How to return a result from an active object state machine
I frequently use the concept of Active Objects (https://www.state-machine.com/active-object) combined with state machines when designing code. The key idea behind these is that only "events"...
0
votes
2
answers
125
views
How to cope with state flows in UML?
I got a few questions about using UML state machines in software architecture:
I have to design an STM and express it as part of a UML model. There is a singelton STM Maintainer holding the instance ...
3
votes
1
answer
167
views
How to handle a state machine side effect being optional?
I have a state machine that, as a side effect of going into a certain state, sends a message to a remote server. In some situations, however, I don't want the state machine to send that message, even ...
0
votes
3
answers
568
views
How to implement state machine side effect that needs data the state machine doesn't have
Given a state machine that implements a certain protocol. I need multiple instances of this protocol running, so I create multiple instances of this state machine. Each instance is associated with a ...
3
votes
4
answers
359
views
Reducing cyclomatic complexity of a state machine
I have a function (written in Python) that processes a loosely structured log file.
The log file would have begin-end markers for different sections, with each section describing different things (e.g....
1
vote
0
answers
93
views
Limiting exposed interface for state transitions
Scenario: Given a class with some internal state and methods to manipulate this state, I want to limit the exposed methods that are available to potential clients/users of my API.
TLDR: In the ...
0
votes
1
answer
140
views
How to Represent actions in a UML state diagram that may be executed from a base state or as a result of another action from that state
I am creating a UML state diagram to help me plan the card game simulator I'm working on. At the moment I'm stuck on an issue where actions that can be performed from the "Main" state, the ...
1
vote
1
answer
424
views
How to implement a RegEx library in C [closed]
Background
I have been attempting to create a line editor in C, eventually becoming a visual editor, and as a means of both allowing the editor to be useful but also learn more about C development, I ...
2
votes
1
answer
714
views
UML State Machine Diagram - How to model an event that occours repeatedly
I'm trying to model the evolution of a player's energy in a game.
I have an "alive" state, and a transition to it from the initial pseudostate that has the effect of setting the initial ...