Reflex: an architecture for building mobile apps with agents (shopify.engineering)

Writing the same ViewModel twice is cheaper than maintaining a bridge between the two.

Abstractions always needed to earn their place. That cost/benefit of adopting an abstraction is rapidly changing in today’s LLM world. Duplication is increasingly cheaper than the wrong abstract.

We landed in the middle, on something closer to grey box testing. The test doesn’t see pixels and it doesn’t see internals. It sees exactly what the UI sees: the ViewModel’s state and the actions the ViewModel accepts. Everything underneath is the real thing (real reducers, real services, real GraphQL client, real navigation) with fixtures swapped in at the edges where the app would otherwise reach the network or the device. No mocking frameworks anywhere in the suite.

Grey box testing is a new-to-me concept and I immediately grok it. Grey box testing is possible when network interfaces are well defined, and user interfaces are the output of passing finite states through dumb renderers (non-derogatory). You have to trust your network is predictable enough to be mocked and your design language is resilient enough to adapt to the varying compositions of state.

Keeping that discipline is the hard part for humans. For agents, it’s a pattern to repeat, and they’re good at that.

This is real stuff of engineering rigor. You have to have the discipline to hold the boundaries. You have to declare states explicitly, pass messages deliberately, and refuse to accept anything else.

The post cites Elm as the idea behind Reflex. Elm also influenced Dan Abramov’s creation of Redux. And then Dan joining of the React core team to bring those ideas in function components. Elm’s usage still seems relatively small. It just may be the least deployed and most influential idea for building responsive and resilient interfaces.