Skip to main content

Questions tagged [finite-state-machine]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
81 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 ...
Emile Papillon-Corbeil's user avatar
1 vote
2 answers
137 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 ...
Pablo's user avatar
  • 119
1 vote
2 answers
99 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, ...
Patrick Wright's user avatar
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 ...
Patrick Wright's user avatar
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 ...
olimtrail's user avatar
0 votes
0 answers
188 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 ...
Patrick Wright's user avatar
1 vote
1 answer
199 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"...
Patrick Wright's user avatar
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 ...
ngong's user avatar
  • 109
3 votes
1 answer
166 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 ...
PieterV's user avatar
  • 215
0 votes
3 answers
562 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 ...
PieterV's user avatar
  • 215
3 votes
4 answers
358 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....
Happy Green Kid Naps's user avatar
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 ...
sfiss's user avatar
  • 908
0 votes
1 answer
137 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 ...
Ben Jaguar Marshall's user avatar
1 vote
1 answer
413 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 ...
greybrunix's user avatar
2 votes
1 answer
712 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 ...
mell_o_tron's user avatar
3 votes
4 answers
788 views

Is the combination of state machine and pure function a programming style?

As a university student who just have been learning programming for a year. After I learned about the concept of state machine and the pure function in functional programming, I suddenly got an idea ...
Equescript's user avatar
1 vote
1 answer
431 views

Domain Driven design and representing process state

I'm trying to find a good way to implement state transitions for a job posting. This is just an experiment in trying to write better code. You can find the code and a diagram in this repo. The main ...
Rob's user avatar
  • 19
0 votes
0 answers
58 views

UML Statecharts

I have been using an implementation of UML statecharts in C++ similar to that defined in the book "Practical Statecharts in C/C++" by Miro Samek (https://www.state-machine.com/psicc). One of ...
Patrick Wright's user avatar
1 vote
2 answers
132 views

Modelling an A to B movement controller, split or merge position and movement as state machines

I am currently creating a software model for controlling a simple (two-way) pneumatic cylinder. In essence, this controls just a movement from point A to point B. The controller has two outputs (...
Cédric Moers's user avatar
0 votes
2 answers
570 views

Should I instantiate the state objects of a finite state machine?

I have a class hierarchy with a base State class, several inheriting classes each named after their relevant state, and an FSM class that contains all the states in a particular state machine as well ...
ewhiting's user avatar
  • 329
0 votes
1 answer
250 views

Is it OK for Finite State Machine entry actions to trigger events?

We're using some FSM library that allows you to define entry and exit actions. For some reason, somebody needed to do this fsm.Configure(State.A) .Permit(Trigger.A, State.B) ....
SuperJMN's user avatar
  • 453
0 votes
3 answers
383 views

UML - State Machine Diagrams: Mapping States which can be transitioned to from anywhere

I am trying to model a case management system in a UML State Machine Diagram. It is an approval style process and the case can enter a withdrawn state at any time if it is no longer required. This ...
Stephen Lew's user avatar
0 votes
2 answers
253 views

Why are these options correct for this state machine diagram question?

Considering the following state machine diagram, it is CORRECT to state that: Select one or more: a. the Restart event will always be executed in the Halted state. b. After a Halt and Restart event ...
computerscienceisapain's user avatar
0 votes
1 answer
932 views

How can I unit test state machines in C

In an 8bit mcu, I wrote a piece of code of a state machine using a function pointer static void (*state)(void);. Inside the same compilation (let's say sm.c) unit I implement all the available states. ...
MrBit's user avatar
  • 233
1 vote
1 answer
450 views

Hierarchical State Machines - Ortho Regions

I am rather unclear about how an event gets processed when a state machine has orthogonal regions. I did read that With composite states, that an event should be sent to the innermost state, and if ...
Christopher Pisz's user avatar
1 vote
5 answers
1k views

Do state machine based programs have a processing loop - or even exist?

Short Version If we had an application based on a state machine - transitioning between states to run the application: is repetition, and in fact the entire state machine, based on the presence of an ...
Ian Boyd's user avatar
  • 24.8k
1 vote
0 answers
371 views

Terse finite state machines in Haskell

I'm writing a parser for a markup language in haskell, and a finite state machine fell out of my ideal API. I have code that looks a bit like this: Token = BoldWord String | Word String | ...
user avatar
1 vote
1 answer
245 views

State Pattern when the Behavior in Object of Type A is Dependent on the State of the Object of Type B

I have used the state pattern for my web application where a user can be in one of three states: activated, required_activation and suspended. I have created 3 states classes as given below (source is ...
Khuram's user avatar
  • 137
1 vote
1 answer
360 views

Do State diagrams Only Represent Individual Objects states?

On website uml-diagrams.org it is mentioned that state machine diagram is a behavior diagram which shows discrete behavior of a part of designed system through finite state transitions. To the best of ...
Afia R. S.'s user avatar
5 votes
1 answer
589 views

Using Choice Node in State Machine Diagrams

In State Machine diagrams, in some online resources, the condition is merely drawn on the arrow (the left figure below) and in others similar to right figure, where a choice node is specifically used. ...
Karl 17302's user avatar
1 vote
1 answer
264 views

State Diagram: How to Represent a Parent/Child Object's States Properly?

I made a state diagram for the Purchase object (parent) and for the Item object (child), as you can see below. One of my doubts is how to represent the integration between parent/child objects in the ...
Alex Boorjs's user avatar
-1 votes
3 answers
1k views

How to draw/design a state machine with multiple threading

I'm developing a module, which is very complicated. I'm trying to draw a state machine but I don't know if a state machine can present multiple threading cases. Basically, the module processes the ...
Yves's user avatar
  • 203
1 vote
1 answer
3k views

Managing multiple state machines interacting with each others in ES5 Javascript

I have multiple state machines (7) managed by a "main" function. Because of system constraint this will be run on an old qtweb browser with ES5/IE11-like behaviour. So no promises etc. I'm ...
The Mark's user avatar
0 votes
1 answer
186 views

Confusion in UML 2 state chart design for a CAN bus data logging sensor

I have the following requirement to design behavior of a software component for logging sensor, which writes data to SD card a: Datalogging sensor can write data to a FAT16-formatted SD card that is ...
Priom Biswas's user avatar
1 vote
1 answer
659 views

State machine - how to handle outside environment values?

I've got a state machine implementation in Unity that I'm working on (C#), the plan being that it will be mostly used for AI related things. I'm not sure how I should deal with various "inputs&...
Jake1234's user avatar
  • 129
0 votes
0 answers
103 views

Converting monolithic application to microservice architecture with sagas

I'm looking for architectural guidance. I've got this monolithic application. It has a payment platform functionality, where payments are made, scheduled or on demand, via some banking API. Payments ...
kosmakoff's user avatar
  • 109
3 votes
2 answers
452 views

Is rebooting a server idempotent or not?

In his article RESTful Casuistry, Tim Bray claims that rebooting a server is not idempotent: But I don’t buy it, and here’s why. If I want to update some fields in an existing resource, I’m inclined ...
Géry Ogam's user avatar
-2 votes
1 answer
209 views

Is there a name for this kind of state machine?

I'm thinking of a GUI architecture that works like a finite-state machine where there is a set of possible states and a set of possible inputs--or events. The thing is, some states transition to the ...
funct7's user avatar
  • 162
-2 votes
1 answer
247 views

Scaffold design pattern [duplicate]

I'm looking for something that might be described as a "Scaffold design pattern". I'm in the process of resurrecting an old piece of working but very buggy code that implements a Finite ...
Keith Whittingham's user avatar
1 vote
1 answer
460 views

How to avoid repeating same states in a finite state machine implementation?

I have been implementing a finite state machine which basically ensures configuration of the external chip which communicates with my MCU via I2C. The skeleton of the configuration state machine looks ...
Professor Jimatura's user avatar
1 vote
2 answers
517 views

Identifying states when using state machine to validate a form field

Scenario is simple, a password field with few validation rules. The states I came up with are default ( when the form loads or reset button is pressed) filled ( should this even be a state ?) valid ( ...
ama's user avatar
  • 21
-1 votes
1 answer
132 views

oval of FSM diagram represent what?

I am reading a document of Varnish and I get the important VCL state image shown below. We know we often use UML as a standard to draw a state machine. but this image is not, is it follow another ...
244boy's user avatar
  • 117
-4 votes
1 answer
889 views

What's the best way to design a state machine with different object inheritance

I have a class A and class B, both derive from the same parent class. Each object has a state machine inside it that defines it's behaviour. The behaviour is different though depending on if the ...
damox's user avatar
  • 1
0 votes
2 answers
278 views

FSM diagrams - Modern device with battery / charger

I'm studying state machines diagrams and was asked to come up with a diagram for a device that turns on and off when a button is pressed... but as with other modern devices nowadays, it can operate ...
h0tfus3's user avatar
  • 121
1 vote
4 answers
610 views

Documentation of Finite State Machine / Workflow

In my database, I store task data (id, timestamp, input data), and information about the state of the multi-step processing (e.g. prepare, execute, summarize). The program moves from one state to ...
Karsten W.'s user avatar
2 votes
1 answer
203 views

State Pattern: duplication in State and Context

Wikipedia gave an example of State Pattern: Define LowerCaseState and MultipleUpperCaseState, both inherite from State. interface State { void writeName(StateContext context, String name); } ...
kexanie's user avatar
  • 121
4 votes
1 answer
865 views

Repeating a state in a state machine

I have a state machine in which I might have to restart something when needed (Say restart a hardware). But after restarting, I need to run some tests on the thing. If the tests fail, I need to stop ...
doca's user avatar
  • 245
2 votes
1 answer
386 views

State Machine: what object is responsible for state transfer?

I would like to create a state machine. Each State would have its run method, and, according to some logic would then set a next state. Option 1: If each state is responsible for determining a next ...
Gulzar's user avatar
  • 1,240
0 votes
1 answer
260 views

Edit and extract the response of a system from its State machine diagram

Consider the following state machine diagram: If we have the following event sequence : Close door --> Start --> Open door --> Reset and we need to know the corresponding response ...
John adams's user avatar
5 votes
2 answers
592 views

In an UML 2.5 State Machine, how can I model sending a Signal as an effect on a transition in a convenient way?

In an UML 2.5 State Machine, how can I model sending a Signal as an effect on a transition in a convenient way? In one of the older UML versions you simply prefixed the name of the signal with a send ...
nanitous's user avatar
  • 159