Skip to content

Commit 427761b

Browse files
authored
Merge pull request #227 from statelyai/davidkpiano/update-docs-images-for-what-is-a-state-machine
Update images for "What is a state machine?" post
2 parents 3769fe1 + aaf9b44 commit 427761b

10 files changed

+15
-16
lines changed
214 KB
Loading

blog/2023-10-02-what-is-a-state-machine/index.mdx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,13 @@ If you’ve worked with flowcharts or diagrammed a process on a whiteboard with
1818

1919
A state machine is a way of modeling how something works, using states and transitions to show how something changes over time in response to events.
2020

21-
![Two states of locked and unlocked. On the unlocked state you can transition to un-locked on a coin event or transition to locked on a push event. On the locked state you can transition to un-locked with a coin event or transition to locked with a push event.](turnstile-state-machine.svg)
21+
![A state machine for a music player. The state machine starts in the Paused state, and on play, goes to the Playing state. On pause, it goes back to the Paused state. In any state, you can skip to the next track.](music-player-state-machine-dark.png)
2222

2323
Specifically, it formally models how a system transitions from one state to another based on specific events (e.g., triggers, signals, changes, etc.). Think of it as a useful tool for visualizing and designing the flow of user experiences, product features, or any process you’re working on.
2424

2525
Visually, state machine diagrams are similar to flowcharts. Both use shapes to represent states (e.g., steps in a flow) and arrows to indicate transitions between those states. The main difference is that state machines are more precise, formal, and powerful than flowcharts. They’re also more flexible since you can use them to model any kind of logic, not just processes.
2626

27-
<p>
28-
<ThemedImage
29-
alt="A booking state machine with an initial idle state. From idle you can transition to car booking, flight booking, and hotel booking states."
30-
sources={{
31-
light:
32-
'https://prodstack-ogimagebuckete7b3c4ce-fcz4tpdpagli.s3.amazonaws.com/studio-ec345257-35c4-4fcc-bfbc-9a9255bc8d13-light.png',
33-
dark: 'https://prodstack-ogimagebuckete7b3c4ce-fcz4tpdpagli.s3.amazonaws.com/studio-ec345257-35c4-4fcc-bfbc-9a9255bc8d13-dark.png',
34-
}}
35-
/>
36-
</p>
27+
![A booking state machine with an initial idle state. From idle you can transition to car booking, flight booking, and hotel booking states.](flight-booking-state-machine.png)
3728

3829
State machines are a concept deeply rooted in computer science; however, they have broad applications that extend to various business domains and design disciplines. From developing intuitive software interfaces to designing effective business processes, state machines provide a structured way to model and understand complex systems. Whether you’re a product owner, project manager, designer, developer, QA tester, business analyst, or any other role, understanding state machines can significantly improve your ability to design, manage, and refine features, processes, and products.
3930

@@ -147,7 +138,7 @@ There are many key advantages of using state machines:
147138

148139
With state machine diagrams, you can visually represent the states of a process, making it easier to grasp and communicate complex logic. These diagrams bridge the communication gap between technical and non-technical team members. They also provide a clear way to document and share app logic, which you could use for onboarding new team members. After all, following boxes and arrows (just like a flowchart) is much easier than parsing code, especially for someone unfamiliar with the codebase.
149140

150-
![A mermaid diagram of our order state machine.](mermaid-diagram.svg)
141+
![A mermaid diagram of our order state machine.](mermaid-order-machine-dark.png)
151142

152143
_Our [export to Mermaid feature](/docs/export-as-code#export-formats) enables you to embed your state machines in GitHub and GitLab pull requests and comments._
153144

@@ -172,39 +163,49 @@ _Our [export to Stories feature](/docs/export-as-code#export-formats) enables yo
172163
#### orderMachine.Pending
173164

174165
1. _Start_
166+
175167
**State** `orderMachine.Pending`
176168

177169
#### orderMachine.Shipped
178170

179171
1. _Start_
172+
180173
**State** `orderMachine.Pending`
181174

182175
2. **Event** `item shipped`
176+
183177
**State** `orderMachine.Shipped`
184178

185179
#### orderMachine.Delivered
186180

187181
1. _Start_
182+
188183
**State** `orderMachine.Pending`
189184

190185
2. **Event** `item shipped`
186+
191187
**State** `orderMachine.Shipped`
192188

193189
3. **Event** `item delivered`
190+
194191
**State** `orderMachine.Delivered`
195192

196193
#### orderMachine.Returned
197194

198195
1. _Start_
196+
199197
**State** `orderMachine.Pending`
200198

201199
2. **Event** `item shipped`
200+
202201
**State** `orderMachine.Shipped`
203202

204203
3. **Event** `item delivered`
204+
205205
**State** `orderMachine.Delivered`
206206

207207
4. **Event** `item returned`
208+
208209
**State** `orderMachine.Returned`
209210

210211
:::

blog/2023-10-02-what-is-a-state-machine/mermaid-diagram.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.
191 KB
Loading
216 KB
Loading
110 KB
Loading
118 KB
Loading

0 commit comments

Comments
 (0)