Rickard Oberg is popular among Java developers. He has given seminars at all main Java conferences world wide. He worked as an architect at JBoss and other popular OpenSource Java frameworks, and wrote a book on RMI. In recent years, he has become famous as an Aspect Oriented Programming (AOP) crusader. He has worked with bleeding edge AOP in a portal product that has become a great commercial success, and is currently working on Qi4j at Jayway. Rickard is a DZone MVB and is not an employee of DZone and has posted 16 posts at DZone. You can read more from them at their website. View Full User Profile

DCI is not MVC

  • submit to reddit

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

Published at DZone with permission of Rickard Oberg, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)



Martin Spasovski replied on Wed, 2010/05/26 - 12:13pm

For those new in DCI here's another great article: http://www.artima.com/articles/dci_vision.html


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.