Transfer Data vs. Transfer Control – Short Note
-
Transfer data means: “Here is some information.”
One component sends or returns values (objects, messages, DTOs) to another. The receiver may use this information now or later, but the sender is mainly concerned with what data is passed, not with deciding the whole future sequence of steps. -
Transfer control means: “You decide what happens next.”
One component hands over the right to drive the execution flow. While another component runs, it chooses which operations to call, in which order, and when to give control back. Control is about who owns the flow, not about the bytes themselves. -
Common forms of control transfer:
- Direct calls:
AcallsB.doSomething(). While insidedoSomething, B controls which functions are called and for how long. - Callbacks/events:
Aregisters a callback withB. Later,Binvokes it, deciding when to give control back toA. - Orchestrators/workflow managers: A special component calls several steps in order, deciding the sequence and branching based on outcomes.
- Direct calls:
-
Data vs. control mixed:
Most real interactions involve both:- Data is passed as parameters, return values, messages.
- Control moves as calls, callbacks, and state machines determine what happens next.
The key distinction: data = content, control = who drives the story right now.
-
Navigator example in MVC:
In an MVC-style app, a Navigator/Router/FlowController is a component whose job is to decide which controller/view comes next:- User submits login form on LoginView.
- LoginController validates input and calls AuthService (data transfer).
- AuthService returns success/failure (data transfer).
- Navigator inspects the result:
- On success: tell the system to show HomeView (navigate to home).
- On failure: keep LoginView and show an error.
Here, controllers and services mostly move data around (credentials, user info, error messages), while the Navigator is responsible for transfer of control between screens—it decides which part of the application should be active next.
-
Why this distinction matters:
Separating “who holds data” from “who controls the flow” makes architectures clearer. Models and services focus on data and logic; navigators, routers, or coordinators focus on application flow. This separation often makes systems easier to reason about, test, and evolve.
浙公网安备 33010602011771号