import { swiss } from '@mdx-deck/themes'; import CodeSandboxLayout from './layouts/CodeSandboxLayout'; import MainLayout from './layouts/MainLayout'; import './layouts/slides.css';
import CodeBlock from './components/CodeBlock'; import Column from './components/Column'; import MachineInspector from './components/MachineInspector'; import Row from './components/Row'; import TrafficLight from './components/TrafficLight'; import TrafficLightWithControl from './components/TrafficLightWithControl'; import VideoBlock from './components/VideoBlock';
import { calibrationSwitch } from './code/calibration-bugs'; import { simpleStateMachine } from './code/simple-state-machine'; import { expandedTrafficLightMachineCode, trafficLightCode, trafficLightMachineCode, } from './code/traffic-light';
export const theme = swiss;
<title>Modeling UI with Statecharts</title>Kelli Rockwell
import sutro from './images/sutro.png';
import loadingSpinner from './videos/loading-spinner.mp4';
<VideoBlock label={'*Dramatization, not actual user recording'} source={loadingSpinner} />
import inProgress from './videos/in-progress.mp4';
<VideoBlock label={'*Dramatization, not actual user recording'} source={inProgress} />
- We changed the application logic and the UI got out of sync
- We changed the application logic and the UI got out of sync
- We tried to take a shortcut
Default case is supposedly impossible to reach:
{calibrationSwitch}
- We changed the application logic and the UI got out of sync
- We tried to take a shortcut
- We forgot to reset a condition
- We missed an edge case
- We didn't handle an API response properly
- ...
import hwFlowDiagram from './videos/hw-flow-diagram.mp4';
import statechart1 from './images/reassuring-statechart.jpeg'; import statechart2 from './images/reassuring-statechart-2.jpeg'; import statechart3 from './images/reassuring-statechart-3.jpeg';
import prototypes from './images/prototypes.png';
{simpleStateMachine}
The problem here isn't the switch statement, it's that the state machine is implicit
{calibrationSwitch}
import xstate from './images/xstate.png';
{trafficLightMachineCode}
{expandedTrafficLightMachineCode}
import stateExplosion from './images/state-explosion.svg';
import stateExplosionFixed from './images/state-explosion-fixed.svg';
{expandedTrafficLightMachineCode}
{trafficLightCode}
- On that note, let's talk takeaways
- Keeping UI in sync with application logic is universally hard
- Keeping UI in sync with application logic is universally hard
- Implicit state machines make it harder
- Keeping UI in sync with application logic is universally hard
- Implicit state machines make it harder
- You're probably already thinking in state machines
- Keeping UI in sync with application logic is universally hard
- Implicit state machines make it harder
- You're probably already thinking in state machines
- Statecharts = beefed up state machines
- Keeping UI in sync with application logic is universally hard
- Implicit state machines make it harder
- You're probably already thinking in state machines
- Statecharts = beefed up state machines
- Modeling UI with statecharts is something you should consider doing :)