# David Khourshid: Simplifying Complex UIs with Finite Automata & Statecharts | JSConf Iceland 2018

> For agents: start with the [agent guide](https://ratstack.sh/llms.txt). Every page is Markdown by default; add `Accept: text/html` for HTML.

[JSConf](https://www.youtube.com/@jsconf_) · Published 2018-04-05 · 34:28 · A tier · XState and state machines

[Watch on YouTube](https://www.youtube.com/watch?v=RqTxtOXcv8Y) · [All RatTube videos](/tube)

## Summary

David Khourshid shows how [interface logic](/lore/implicit-state-machines) grows harder to follow as new requirements arrive. A search interface gains cancellation, and scattered conditions give way to explicit [states and transitions](/lore/lifecycles-are-machines).

He represents transitions as data and explores paths through the resulting graph for [testing](/lore/model-based-testing). Statecharts then compress combinations of independent options into a smaller representation. The approach is presented independently of any particular UI framework.

## Section notes

- [0:58](https://www.youtube.com/watch?v=RqTxtOXcv8Y\&t=58s): The talk presents state machines as a framework-independent way to model interfaces.
- [6:24](https://www.youtube.com/watch?v=RqTxtOXcv8Y\&t=384s): Adding search cancellation makes conditional logic more complicated.
- [12:10](https://www.youtube.com/watch?v=RqTxtOXcv8Y\&t=730s): A transition table looks up the next state from a state and event.
- [18:32](https://www.youtube.com/watch?v=RqTxtOXcv8Y\&t=1112s): Paths through a machine can generate scenarios beyond the happy path.
- [24:16](https://www.youtube.com/watch?v=RqTxtOXcv8Y\&t=1456s): Orthogonal statecharts represent combinations without listing every state.

## Key concepts

- [states and transitions](/lore/lifecycles-are-machines)
- [testing](/lore/model-based-testing)
- [interface logic](/lore/implicit-state-machines)

## Our take

The classic introduction to finite state machines and statecharts for UI: how they tame the growth of possible states, and how to implement, test and visualize them.

## Related videos

- [Effective State Machines with XState | David Khourshid | Effect Miami 2](/tube/effective-state-machines-with-xstate-david)
- [Effective state machines for complex logic by David Khourshid (Effect Days 2024)](/tube/effective-state-machines-for-complex-logic)
- [Webinar: State Machines and Actors with XState v5](/tube/state-machines-and-actors-with-xstate)
- [John Hughes - Testing the Hard Stuff and Staying Sane](/tube/testing-hard-stuff-john-hughes)

Summary based on the transcript. Written 2026-11-15.
