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
  • in a word, it’s stateful logic (control) vs stateless logic (data)

Subjectivity aside, leave a reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s