Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
217 views
in Technique[技术] by (71.8m points)

design patterns - DCI - Data, Context and Interaction - Successor to MVC?

What is the best description of Data, Context and Interaction (DCI) to pitch it to an organization?

It's created by Trygve Reenskaug, the creator of the MVC-pattern.

Is it really the successor to MVC or just another pattern? And what are its pros and cons?

question from:https://stackoverflow.com/questions/378629/dci-data-context-and-interaction-successor-to-mvc

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The impression I got is that it's not a successor to MVC so much as a complement, for example figure 5 in the artima article on DCI has both. I think it's supposed to help make the distinction between model and controller more sane, or maybe between different part of the controller or different parts of the model.

The basic idea seems to be to split logic for particular actions our of your data classes and move it to traits/mixins/whatever, one per (user) action. You'll have many small pieces of code, instead of a few large pieces. Also, it sounds like adding new mixins is supposed to be "better" than adding functionality to your base classes. The code for individual actions will probably (I think?) be more spread out, but code for different actions should be more clearly and obviously separated.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...