Beyond Fat Models: An Introduction to DCI

Traditional object-oriented design encourages placing behaviour directly on the classes that hold state. Over time, an Account or Order class accumulates methods from dozens of unrelated use cases – billing, auditing, notifications, reporting – until no engineer can reason about the object as a whole.

Data, Context, and Interaction (DCI) solves this by separating code along two axes: what the system is (stable data models) and what the system does (runtime use cases).

The Four Building Blocks

DCI organises every application around four explicit concepts:

Solving Self-Schizophrenia

In classic OOP, splitting behaviour across mixins, decorators, or wrapper classes introduces self-schizophrenia: this or self inside a wrapper points to the wrapper rather than the underlying domain object, breaking object identity and state access.

DCI avoids this by binding roles directly to domain objects only within the scope of an active Context. Outside the Context, an Account is just an Account. Inside MoneyTransferContext, it acts strictly through its assigned role.

Why Nim Fits Naturally

Most class-based languages struggle to express DCI because methods are permanently welded to class definitions. Nim separates object definitions from proc procedures by default. Combined with Uniform Function Call Syntax (UFCS) – which lets proc withdraw(self: SourceAccount, amount: int) be called as source.withdraw(amount) – Nim expresses DCI idioms directly using built-in language primitives.