DCI is not MVC

DZone 's Guide to

DCI is not MVC

· Java Zone ·
Free Resource

The NetBeans project has produced a screencast about DCI and MVC, where DCI is "Data, Context, Interaction" and MVC is "Model, View, Controller". Although the screencast is interesting, and it is important to try and understand this powerful new DCI concept, it is also important to realize that DCI is new, and is not a variant of MVC. If anything, they are buddies that can be used together. Unfortunately it is common to try and map a new concept onto what you already know, and this screencast does that to some extent.

So what is the relationship between MVC and DCI? MVC is about using a View which can drive actions in a  Controller, which then operates on the Model. DCI, then is one way in which you structure interactions with that model. The Controller(s) build up a Context, with mappings of objects to roles in that Context, and then invoke an Interaction using the Context. Roles can then lookup other Roles from that Context, and perform the algorithm.

Before DCI the Controller would be working directly on the Data, thus being tightly coupled with that Data. With DCI the Controller is instead coupled to the Context and Interactions, rather than the underlying Data. The Controller then becomes reusable for the Context+Interaction, rather than the Data, and can operate on any mapping from Data to the Roles in the Context.

This, as I see it, is how DCI and MVC relate. DCI is *not* an "evolution of MVC". It's a way for MVC to be more generically applicable to various Data models, without having to know the specifics of that model. The Lookup facility in NetBeans is one mechanism to accomplish this. Doing something similar in Qi4j is also trivial, since Qi4j allow the developer to add Roles to a Data model natively, rather than using the Adapter pattern.

From http://www.jroller.com/rickard/entry/dci_is_not_mvc


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}