DCI Sample

DISCLAIMER: The views and code presented here are not an official representation of the DCI (Data-Context-Interaction) paradigm but purely represents my personal understanding of DCI so far.

I want to share this understanding with you and hope that you’ll find some code and thoughts useful, and that you’ll continue listening to all available sources of experience within this new field (see some links in the left column) to make your own transition into this exciting new paradigm. I also want to listen to you, if you have some ideas for improvement in code or understanding :-)

I have read and participated in discussions in the DCI forums since summer 2010 and coded some smaller examples (10 variations of the money transfer example and 5 variations of the frontloading example) to explore how DCI could be implemented with Java/Qi4j.

After fine-tuning a basic DCI execution model with help from the DCI community I wanted to move on with a bigger ‘real world’ example. It felt natural to port the famous DDD Sample application that demonstrates how you can implement a complex domain (shipping cargos) according to Domain Driven Design principles and the current object-oriented (or class-oriented) programming paradigm.

By coding the same cargo example according to DCI principles we can compare the new paradigm with the old/current and get a sense of what the DCI paradigm can offer us. There’s a chance also that the complexity of the sample (in contrary to smaller examples) can bring new aspects of the paradigm into discussions. Code is available at github or as a zip (1.4 Mb).

Hopefully we’ll see the DCI Sample coded in other languages as well, and I invite you to copy what you want from my sample to make your own implementation – the ‘DCI Sample’ is not mine but a common playground for further DCI studies! I suggest that we collect all the different DCI implementations at github/dci to ease valuable comparisons. Partial implementations and suggestions are also welcome.

DCI is a programming paradigm invented by Trygve Reenskaug and further developed in collaboration with James O. Coplien. One of it’s core achievements is to separate what-the-system-is from what-the-system-does. Data from Behavior. The DCI wiki does a great job of explaining DCI in more detail and you can also follow/participate in the DCI discussions. [from the DCI wiki]


Here’s some of my thoughts about various aspects of DCI from working with the DCI Sample:

  • What-the-system-is
    Organizing the stable data structures of the shipping domain.
  • Process Thinking
    Detailed analysis of how the most complex process in the DDD Sample becomes much more directly understandable when coded with DCI and how the thinking then goes intuitively along processes rather than data structures or technical concerns.
  • Planned articles:
    • What-the-system-does
    • Environment
    • Use Cases
    • Testing
    • Decoupling & Cohesion


Post Revisions:

No comments yet.

Leave a Reply