Nithin Bekal About

Notes / DCI: Data, Context and Interaction

DCI stands for Data, Context and Interaction, and is a programming paradigm that works similarly to OOP, and is easy to implement in languages like Ruby.

An example I came across in this article, explains how we can use mixins to implement DCI in Rails:

user.extend(Buyer)
user.add_to_cart(product_id, quantity)

Here, User contains little or no behavior and is only responsible for data. A Rails controller can act at the context, is responsible for injecting the use case or role into the object.