'. '

DCI

From APIDesign

(Difference between revisions)
Jump to: navigation, search
(Swing Mental Shift)
(Swing Mental Shift)
Line 13: Line 13:
I do remember arguing for ages with an experienced [[Swing]] designer that the (swing) actions are wrong and cannot be used in [[NetBeans]]. I was explaining it all, describing that action by itself cannot do much, that it needs some context and that nothing else can work in modular world. No chance, my message just could not pass the gap between modular and monolithic [[Swing]] mindset.
I do remember arguing for ages with an experienced [[Swing]] designer that the (swing) actions are wrong and cannot be used in [[NetBeans]]. I was explaining it all, describing that action by itself cannot do much, that it needs some context and that nothing else can work in modular world. No chance, my message just could not pass the gap between modular and monolithic [[Swing]] mindset.
-
Now I know why! The [[Swing]] designer was imprisoned in the [[MVC]] mental model. For him a component/window represented the model and action was there to act on that model. In [[NetBeans]] this is different - the action is just an ''interaction''. It does not do much by itself, it needs properly filled [[Lookup|context]] to enable itself and invoke some operation. From where the context arrives (is morphed) remains unknown until that really happens. Until some module morphs its data into appropriate [[Lookup|context]].
+
Now I know why! The [[Swing]] designer was imprisoned in the [[MVC]] mental model. For him a component/window represented the model and action was there to act on that model. In [[NetBeans]] this is different - the action is just an ''interaction''. It does not do much by itself, it needs properly filled [[Lookup|context]] to enable itself and invoke some operation. The context is then morphed by any window/component that wishes to be recognized by the ''interaction''. It needs to morphs its data into appropriate [[Lookup|context]].
Quite easy if you have good theory to backup your reasoning with, isn't it?
Quite easy if you have good theory to backup your reasoning with, isn't it?

Revision as of 20:45, 22 September 2009

Data/Context/Interactions - a modernized version of MVC. Originally described at artima article. Here is mine and Geertjan's screencast explaining why DCI is important for development of modular applications and how to realize DCI via Lookup:

Emotionally Attached to Model

The base difference mentioned in the screencast is that in MVC only the model is independent on the rest. The view, controller or presenter are always assumed to know what the model is and operate directly on it.

This is not true in DCI. The interactions are written without knowing the actual data. They are general and need to be turned into concrete ones by establishing proper context before they can be performed, executed.

Swing Mental Shift

I do remember arguing for ages with an experienced Swing designer that the (swing) actions are wrong and cannot be used in NetBeans. I was explaining it all, describing that action by itself cannot do much, that it needs some context and that nothing else can work in modular world. No chance, my message just could not pass the gap between modular and monolithic Swing mindset.

Now I know why! The Swing designer was imprisoned in the MVC mental model. For him a component/window represented the model and action was there to act on that model. In NetBeans this is different - the action is just an interaction. It does not do much by itself, it needs properly filled context to enable itself and invoke some operation. The context is then morphed by any window/component that wishes to be recognized by the interaction. It needs to morphs its data into appropriate context.

Quite easy if you have good theory to backup your reasoning with, isn't it?

Yet Another Layer

In some sense the DCI brings another level of indirection ("all problems in computer science can be solved by another level of indirection", can't they?). The interactions known only what context they need, not the real data - e.g. model. In the classical MVC terms the CI is itself an MVC and there is a bridge morphing the D to the new M. This may not seem like a really big change and indeed, technically, it is not. However the mental shift is huge!


<comments/>

Personal tools
buy