DCI in Nim - Breakthrough?
Is this the Enterprise Architecture Breakthrough We've Been Waiting For?
Is this the Enterprise Architecture Breakthrough We’ve Been Waiting For?
For decades, enterprise software has lived with an uncomfortable compromise. We wanted systems that mirror how a business actually operates, yet the tools we standardized on forced us to scatter our most critical business processes across layers of indirection.
When you combine Data, Context, and Interaction (DCI) with Nim, that compromise disappears. For the first time, we have a typed, compiled, high-performance, non-VM language capable of turning enterprise workflows into readable, statically verifiable artifacts.
The Testing Crutch vs. Static Process Verification
Because classic OOP fractures a single business workflow across multiple classes, interfaces, and runtime polymorphic dispatches, you cannot statically read or analyse a process in advance of actually running it.
To compensate, most of us rely heavily on a massive testing crutch. Since neither the compiler nor a simple walkthrough can prove that a workflow makes sense in all circumstances, we have no choice but to write unit tests that cover various scenarios to catch the full variety of codepaths that might arise at runtime. Few of us question the enormous overhead of testing every which edge-case on every code commit.
The creator of DCI, Trygve Reenskaug, was fond of quoting Dijkstra (1970):
If debugging is the process of removing software bugs, then programming must be the process of putting them in.
Program testing can be used to show the presence of bugs, but never to show their absence. In other words you cannot design quality into a system by testing it afterwards.
Tests are essential for verifying business logic, but using them as a substitute for structural clarity as well is exhausting:
- No end-to-end walkthrough: A developer or auditor cannot open a single artifact and trace a payment, an order fulfilment, or an underwriting decision top-to-bottom.
- Runtime surprises: Polymorphic dispatch and framework magic push structural errors all the way to the test environment, where one hopes they may be exposed and fixed.
Imagine if the domain logic, and structural components were orthogonal. You could have one test suite for the structural elements, and then another for each domain procedure. The N x M combinatorial explosion of test scenarios would evaporate.
Rust Raised the Bar
In recent years, Elm and Rust changed the conversation around software reliability. They proved to the industry that raising the level of abstractions while simultaneously outlawing entire classes of bugs and catching many more, up front, at compile time – before a single test runs – is a massive engineering win.
No-one expects Rust to be good for enterprise domain modelling at the same time as solving harder problems. So the search for an expressive, approachable vehicle for implementing high-level enterprise business artifacts has continued.
Why Finding Nim + DCI Is a Genuine Breakthrough
Invented by Trygve Reenskaug (creator of MVC) and James Coplien, DCI cleanly divides an application into three distinct elements:
- Data: Dumb, stable domain models representing what the system is.
- Context: The stage that binds Data objects to use-case-specific Roles at the moment an action occurs.
- Interaction: Self-contained, readable workflow executed between those Roles, representing what the system does.
DCI as an idea has existed for years. Shrouded by obscurity it has never conquered any domain, least of all the enterprise where it is most needed. Until now, it has mostly lived in Smalltalk – a true live object environment – or in duck-type-friendly scripting languages like Ruby, Perl, Lua, and PHP. These runtimes can inject roles at runtime, but they do so by deferring type and method resolution until execution - not an attractive proposition for an enterprise architect, having no type checking, no static verification or native compilation. This is what makes Nim paired with DCI architecture such a sensational find – it hits the exact sweet spot we have been looking for:
-
Typed and Compiled, Zero VM: Nim compiles directly to native machine code via C/C++ with a choice of deterministic memory management schemes, no JVM warmup, and minimal footprint.
-
Static Process Analysis: Using Nim’s
distincttypes and Uniform Function Call Syntax (UFCS), Roles and Interactions are verified strictly at compile time. Passing an object into the wrong role isn’t a failed unit test – it’s a compile error. -
Readable, Auditable Workflows: A DCI Context in Nim reads like a plain-English specification. An architect, developer, or auditor can walk through an entire business transaction in one place, seeing every role and interaction laid bare.
-
Approachable Ergonomics: Unlike Rust, Nim gives you Python-like readability and effortless domain modelling without fighting the compiler.
-
Thanks to Trygve, DCI fixes this architectural mismatch.
-
Thanks to Nim, we finally have a typed, compiled, non-VM vehicle that treats business processes as first-class, statically verifiable citizens.
In the next parts, we will move from theory towards production-ready Nim code.
