Beyond Fat Models: An Introduction to DCI Architecture

Why object-oriented code gets tangled over time, and how Data, Context, and Interaction (DCI) separates what a system is from what it does.

If you have ever worked on a mature web application or enterprise codebase, you have probably seen the Fat Model problem firsthand.

It starts innocently enough. You create an Account or User class to represent your data. Six months later, that single file is 2,000 lines long – bloated with methods for money transfers, password resets, PDF exports, tax calculations, and admin audits. Everything that touches a User ends up living inside User.

This happens because traditional Object-Oriented Programming (OOP) merges two fundamentally different things into a single construct (the class):

  1. What the system is: The stable domain state and data structures.
  2. What the system does: The dynamic workflows and use cases that change every sprint.

In 2009, Trygve Reenskaug (the inventor of MVC) and James Coplien introduced Data, Context, and Interaction (DCI) to solve this exact problem.

The Core Idea Behind DCI

DCI splits your architecture along mental lines that match how both users and developers naturally think about software:

Why DCI Struggled in Traditional OOP – and Shines in Nim

In languages like Ruby, C#, or Java, implementing DCI requires fighting the language’s class system. You have to dynamically inject methods into object instances at runtime (risking subtle bugs and performance hits) or wrap objects in heavy adapter classes.

Nim sidesteps this entire struggle by design.

Because Nim separates object data definitions from proc behaviors out of the box – and connects them with Uniform Function Call Syntax (UFCS) – you do not need runtime metaprogramming or heavy frameworks to do DCI. Instead, Nim’s distinct types let you bind Data to Roles at compile time with zero runtime overhead.

What We Will Build in This Series

Over the next two parts, we will build a working DCI architecture in clean, idiomatic Nim without a single external dependency: