Prototyping in code
Throwaway branches, fake data, fast feedback loops.
- Build a coded prototype in hours, not days
- Use fake data and fake latency to test how something feels
- Know when a prototype has answered its question
Static mockups can't show timing, scrolling, real text lengths or slow networks. A coded prototype can, and building one fast is one of the most useful things a UX engineer does.
Answer one question
A prototype exists to answer a question: does this transition feel right, is this list scannable with real data, does this flow survive a slow connection? Write the question down first. It tells you what to build and, just as importantly, what to skip.
Fake everything else
- Data — hard-code a realistic array. Include the long name, the empty value and the 300-item list.
- Latency — wrap requests in a delay you can change, so you can feel 100ms, 1s and 5s.
- Errors — add a switch that makes the next request fail.
const fakeFetch = <T,>(data: T, ms = 800, fail = false) =>
new Promise<T>((resolve, reject) =>
setTimeout(() => (fail ? reject(new Error('Network error')) : resolve(data)), ms),
);
Keep it disposable
Build on a throwaway branch or in a scratch project. Skip tests, ignore architecture and hard-code freely. The moment you start making a prototype production-ready, it stops being fast.
Share it
Send a link or a short screen recording, and ask about the one question you set out to answer. Live prototypes settle debates about feel faster than any meeting.
Pick an open design question about an interaction (a transition, a loading state, a gesture). Build the smallest coded prototype that answers it, with fake data and an adjustable delay, and share a link or a recording with your designer.