[UPDATE: This post has been obsoleted by SIDA: Moving Object-Oriented Design beyond Model-View-Controller]
I recently read about The DCI Architecture: A New Vision of Object-Oriented Programming, a successor/complement to the original Model–View–Controller design pattern, by one of the original authors. The DCI stand for:
I was both impressed and confused. Impressed because I’ve been thinking for a while that MVC wasn’t quite sufficient, and this seems like a big leap forward. Confused, because most of their discussion revolved around roles
(typically implemented as traits
) and algorithms
, so I couldn’t quite figure out where exactly Context and Interactions fit in — much less how they related to MVC objects.
To help me sort it all out in my head, I developed a comprehensive picture I call DIDA
, which attempts to incorporate both MVC and DCI in a single unified design pattern. DIDA stands for:
In a sense, it uses the critique from DCI to tease apart to the components of MVC. In particular, traditional MVC tends to combine the roles and data into model classes, the presentation and interface into a view hierarchy, and all the actions and algorithms into a single controller. The key insight of DCI (as best I understand it) is that roles should be kept distinct from the “mostly dumb” data, and only bound in the context of a particular algorithm, which should be clearly spelled out in its own software construct. I used the same logic to similarly extract the Presenter Pattern
from views and to separate controllers from algorithms.
The basic idea is that the Interface, Data and Algorithms are three primary nouns you need to Design as part of an application (roughly in that order). Those in turn determine the roles, presentation, and actions necessary to wire everything together. Depending on the use cases, it may make sense to implement everything as traditional MVC objects, but it might be wiser to use, e.g., traits, presenters, and strategies
to enable weaker coupling.
As far as I can tell, this approach captures the key benefits of DCI, but is much easier to understand and apply. Of course, I could easily be overlooking something. Please let me know what you think.