Decoupling Control from Data

From my previous post, I discussed about decoupling interface from implementation. When I say control, I am referring to the control logic that coordinates everything. In short, it’s the controller.

On the other hand, the data I’m referring to here is the implementation part or simply, the data logic (or code as data). It is the code that has been invoked. The calling code is the controller. Examples:

the Web browser as the runtime for coordinating events and calling the event handler

in Go, the main function should be minimal and serves as the control logic

in a publish-subscribe system, the one that calls the publisher is the control logic

The takeaways:

decoupling interface from implementation is asynchronous

decoupling control from data is based on state from the perspective of control logic