Skip to content

DCI as paradigm?

January 24, 2013

Does Data Context and Interaction (DCI) deserve the category of programming paradigm?

Guys, I won’t bother you with a lot of facts, but this is what  I think … the rest is out there.

DCI is just another design pattern that allows to organize your code using an actor-role metaphor. Its basic line of reasoning starts at and from the point of view of the use case scenarios. It means that it explicitly places the developer in the same position as the users.

In a recent project we thought that in order to merge MVC with DCI (these two created by the same person: Trygve Reenskau), we should apply the formula DCI = M in MVC.  But this pattern would degrade both MVC and DCI, for observe that a whole MVC solution could be embedded in the  context, not just in the model.

This is the rational I follow, and it is kind of postulate:

Between a user and a system there is always a view.
The view is a representation of a use case scenario, which in turn is composed by several use cases.
Only at the level of the use cases the actions on the system are realized.

Following the above line of reasoning, we can use the routing mechanism of any serious MVC implementation to map views with use case scenarios implemented by controllers. The role of the controllers is to create the proper context where a specific action will occur. An action is implemented by a method in a context.

The role of the context  is to gather actors and map them to roles in order to carry out a required action. The action is the interaction among actors by means of data coming from a given business object to data mapping.
Actions always return an result used by the context to select the proper view.

A common mistake is to start thinking abut DCI without any analytic context or problem statement.

For instance if I ask a team of developers to design an online community of chess players where you will find not only players but also visitors, then they have to consider at least 2 points of view of the same system: from players and from visitors.

But the visitors have also the possibility to assume a piece in a game and suggest moves from their stand point of view. Now the concept of user takes a whole new meaning and the developers should consider 32 actors (the total amount of pieces) where only 6 basic roles are present. From these 6 basic roles, the pieces or actors can even evolve into new temporal roles, for instance acting as protection to the king.

As you can see the solution to this problem can be implemented with existing established ways of programming thinking (or paradigm). Do we really need yet another programming paradigm, for which by the way, a new language is being created?

What do you think? Do you want me to drop some code to explain my self more clear or is this enough for an open discussion?

snt

Advertisements

From → Software Matters

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: