Sunday, August 8, 2010

The DCI Architecture

In his new book "Lean Architecture: for Agile Software Development" James O. Coplien shows up with a new programming paradigm: The DCI Architecture.

Before reading this blog I suggest to have a look a the DCI vision document:
http://www.artima.com/articles/dci_vision.html

Let me try to explain DCI in a nutshell.

The idea of DCI is to separate data from business code for better readability while the business code is directly expressed as use case.
DCI stands for Data, Context and Interaction.

Data
Data means POD (plain old data) objects without any business relevant methods.

Context
A context is a place to retrieve and/or setup a necessary data.

Interaction
An interaction is a complex function applied on the data of the context.

Implementing DCI
Implementing DCI is not an easy task since traits are needed. Coplien shows a C++ implementation using template traits as known from the STL. Nevertheless the DCI architecture asks for tool support.

The modified DCI Architecture
My goal is to realize the DCI architecture using actifsource. Therefore an appropriate meta-model is needed.

I decided to keep the DCI idea but modify the model a little bit.

My idea: a UseCase needs 1..N actors (Role) to be implemented. Every role is realized on a POD (plain old data) object.

A context is needed to setup a UseCase and all Data objects which can play the roles needed.

Since a role can be played by any suitable data it seems quite natural that we have to provide kind of an adapter for every Role/Data relationship.

Because I'd like to realize DCI with the actifsource code generator setting up the adapters is no big deal. Instead of hand coding adapters are generated as needed.

No comments:

Post a Comment