Beyond workarounds: DCI offers a genuine take on traditional OOP design patterns
Tags: dci, designpatterns, oop, programming
Published: 2023-11-15 08:50:19

Object-Oriented Programming (OOP) design patterns are established solutions to common problems in software design. However, upon closer inspection, one might consider them workarounds operating within the constraints of the traditional OOP paradigm. This paradigm is, in fact, class-oriented programming with a capital 'C'. It focuses on objects as entities that combine state and behavior, reasoning about the "real world" as categories and hierarchies, rather than as networks of collaborating objects, which was Alan Kay's original vision.

This brief compilation serves as a reference and a slightly more extended response to the word count-restricted comment on this LinkedIn article: https://www.linkedin.com/advice/3/how-can-you-design-structured-programs-easy-read-maintain-hhkcc?trk=cah2

DCI (Data-Context-Interaction) aims to address some of the limitations of OOP by introducing a paradigm where the system's data and its behavior are treated as separate concerns. Here's how DCI can be seen as a radical solution that potentially eliminates the need for certain OOP design patterns:

Role Separation: In traditional OOP, an object's role is often inferred from its class. DCI, however, makes roles explicit. Roles in DCI are about what an object does in a given context, not what it is forever bound to by its class. This can reduce the need for patterns that deal with behavior variations, like Strategy or State patterns.

Behavior Encapsulation: OOP typically encapsulates behavior within objects. DCI encapsulates behavior within contexts, making the code more readable and aligned with the actual use cases, which can diminish the reliance on patterns like Command or Template Method that are used to manage behaviors.

Contexts Over Classes: Many OOP design patterns (e.g., Observer, Mediator) are used to handle interactions between classes. DCI promotes the use of contexts to manage interactions, which can simplify complex communication patterns and reduce the need for intermediary objects or class hierarchies.

Interactions as First-Class Citizens: In DCI, interactions are not second-class citizens that just emerge from objects calling each other's methods. They are first-class citizens that can be directly modeled and manipulated, which could negate the need for patterns that orchestrate interactions like Chain of Responsibility or Mediator.

Object Adaptation: DCI allows objects to take on different roles in different contexts, which can alleviate the need for patterns like Adapter or Decorator that are traditionally used to modify an object's interface or add new responsibilities.

Human Mental Models: DCI is designed to reflect human mental models more accurately than traditional OOP. It models the system based on real-world scenarios, potentially reducing the need for patterns that exist primarily to bridge the gap between human thinking and system design, such as Facade or Builder.


DCI proposes a radical shift in thinking about object interactions, aiming to make the codebase more intuitive and better aligned with the problem domain. However, it's important to understand both the context in which design patterns are used and the context in which DCI can be applied, to make the best use of each according to the needs of the project.