The Pleasure of Finding Things Out: A Feynman-Esque Guide to Flux and Unidirectional Data Flow
Imagine you’re at Los Alamos during the Manhattan Project. You’re surrounded by the brightest minds in the world, working on the most…
The Pleasure of Finding Things Out: A Feynman-Esque Guide to Flux and Unidirectional Data Flow
Unidirectional Data Flow
Imagine you’re at Los Alamos during the Manhattan Project. You’re surrounded by the brightest minds in the world, working on the most secret, complex machinery ever devised. And yet, you notice something peculiar: the filing cabinets containing top-secret documents are locked with cheap, predictable padlocks.
Naturally, being me, I learned how to pick them. Not to steal anything, mind you, but to prove a point: the people in charge didn’t actually understand the security of their own system. They relied on the illusion of safety.
When I look at modern software development, specifically how we manage the “state” of our applications, I see the exact same illusion. We build incredibly complex user interfaces, and then we try to manage the data flowing through them using methods that are, frankly, a bit like locking a top-secret document with a combination of 1-2-3-4.
Today, I want to talk to you about a better way. A way that respects the truth of how systems actually work. We’re going to talk about Unidirectional Data Flow and the Flux Architecture.
But first, we have to understand the mess we’re trying to clean up.
The Traditional Approach: The “Everything-Talks-to-Everything” Tango
For a long time, the traditional approach to UI development was what we call Bidirectional Data Flow (or two-way data binding).
Now, on the surface, this sounds like a wonderful idea. It’s like magic! You type something into a text box, and the data model updates instantly. The data model changes, and the text box updates instantly. They are holding hands, dancing together in perfect sync. Frameworks loved to advertise this. It feels easy. It feels intuitive.
But let me tell you a secret about nature, and about software: what feels intuitive at a small scale becomes an absolute nightmare at a large scale.
Imagine a classroom. In a bidirectional system, every single student has a piece of chalk. They can all walk up to the blackboard and change the answer to the physics problem. But here’s the kicker: the blackboard can also reach out and change what the students are thinking.
If there are two students, it’s fine. But what if you have fifty components in your application? A button updates a form, which updates a list, which triggers a modal, which sends an API request, which updates a global variable, which changes the button again.
In physics, we call this a non-linear many-body problem with feedback loops. It is computationally intractable. In software, we call it “spaghetti code.”
When a bug appears in a bidirectional system, where do you look? Did the view change the model? Did the model change the view? Did some third component sneak in and change both? You are left chasing ghosts.
As I once wrote on my blackboard shortly before I died: “What I cannot create, I do not understand.”
If you cannot trace exactly how a piece of data was created and modified, you do not understand your application. You are just hoping it works. And as I always told my students: “The first principle is that you must not fool yourself — and you are the easiest person to fool.”
Bidirectional data flow is a magnificent way to fool yourself.
The Elegant Solution: Unidirectional Data Flow
So, how do we fix this? We do what physicists do when a system is too chaotic: we impose strict, beautiful rules. We create a Unidirectional Data Flow.
“Unidirectional” is a fancy word that simply means one direction. Like a one-way street. Like the arrow of time. Data flows in a single, predictable, undeniable loop.
This is the heart of the Flux Architecture (popularized by Facebook, and the spiritual ancestor of tools like Redux). Let’s break it down into four simple parts. Imagine we are running a very strict, very well-organized factory.
1. The View (The Worker)
This is your user interface. The buttons, the forms, the beautiful colors. The View has one job: to display data and to listen to the user. When a user clicks a button, the View does not change the data itself. That would be like a factory worker deciding to change the blueprints. Instead, the View creates an Action.
2. The Action (The Memo)
An Action is a plain, simple JavaScript object. It’s a memo that says exactly what happened. It has a type (e.g., "ADD_ITEM") and maybe some payload (e.g., { item: "Bongo Drums" }). It contains no logic. It is just a statement of fact. "I, the user, clicked the button."
3. The Dispatcher (The Foreman)
The Action is handed to the Dispatcher. The Dispatcher is the central hub of the application. There is only one. Its job is to take this memo and broadcast it to the right place. It doesn’t change the data either; it just ensures the message is delivered to the Store. It’s the traffic cop making sure everyone follows the one-way street.
4. The Store (The Blackboard)
Here is the single source of truth. The Store holds the state of your application. When it receives an Action from the Dispatcher, it says, “Ah, an ADD_ITEM action. I know how to handle this." It runs a pure function (a Reducer) to calculate the new state, and it updates itself.
And then, the magic happens: The Store tells the View that it has changed. The View then asks the Store for the new data, and re-renders itself.
Why This is Beautiful (The Physics of Software)
Look at the loop: View → Action → Dispatcher → Store → View.
It is a closed, unidirectional loop. There are no side doors. There are no secret handshakes between components.
Why is this so powerful? Let’s go back to the idea of not fooling yourself.
Suppose there is a bug in your application. The number on the screen is wrong. In a bidirectional system, you’d have to interrogate every component, checking their hidden relationships.
But in a Unidirectional Flux architecture, you simply trace the path backward:
- Is the View displaying the Store’s data incorrectly? (Check the View).
- Did the Store calculate the new state incorrectly? (Check the Reducer).
- Did the Dispatcher send the wrong Action? (Check the Action).
- Did the user click the wrong thing? (Well, that’s on the user).
You have eliminated the mystery. You have turned a chaotic, tangled web into a simple, traceable chain of cause and effect. It is the software equivalent of the scientific method.
(I’m reminded of the Rogers Commission investigation into the Challenger disaster. The engineers knew the O-rings failed in the cold, but the management structure was a tangled mess of bidirectional communication, where bad news was softened as it traveled up the chain. If NASA had enforced a strict, unidirectional flow of raw, unfiltered data from the engineers to the decision-makers, history might have been different. Architecture matters.)
The Pleasure of Finding Things Out
When you first learn about Unidirectional Data Flow, it might feel like a lot of boilerplate. “Why do I have to write an Action, and a Dispatcher, and a Store, just to change a boolean from false to true?"
It’s the same reason we don’t just guess the mass of the electron. We build rigorous experiments to measure it. The boilerplate is the rigor. It is the scaffolding that allows you to build systems of immense complexity without losing your mind.
Software engineering is not about typing clever code. It is about modeling reality in a way that our human brains can comprehend. By forcing data to flow in one direction, we align our code with the way we naturally reason about cause and effect.
So, the next time you sit down to architect an application, don’t settle for the illusion of the easy way out. Don’t build a tangled web of two-way bindings. Build a one-way street. Build a system you can understand.
Because in the end, the greatest pleasure is not just in making the code work, but in knowing exactly why it works.
If you enjoyed this article, imagine what else we could figure out together. Leave a clap, share it with a fellow developer who is tired of debugging spaghetti code, and keep asking “why?”
I’d love to keep the conversation going, *let’s connect on LinkedIn!*
메타데이터
- post_id
- 90cfccfff9bd
- slug
- the-pleasure-of-finding-things-out-a-feynman-esque-guide-to-flux-and-unidirectional-data-flow-90cfccfff9bd
- url
- https://medium.com/@remisharoon/the-pleasure-of-finding-things-out-a-feynman-esque-guide-to-flux-and-unidirectional-data-flow-90cfccfff9bd
- canonical_url
- https://medium.com/@remisharoon/the-pleasure-of-finding-things-out-a-feynman-esque-guide-to-flux-and-unidirectional-data-flow-90cfccfff9bd
- author_url
- https://medium.com/@remisharoon
- status
- ok
- fetched_at
- 2026-07-08 18:29:56