DCI is not MVC
DCI is not MVC
Join the DZone community and get the full member experience.Join For Free
FlexNet Code Aware, a free scan tool for developers. Scan Java, NuGet, and NPM packages for open source security and open source license compliance issues.
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.
Opinions expressed by DZone contributors are their own.