Organizing MVC entities communication
Posted
by
Stefano Borini
on Programmers
See other posts from Programmers
or by Stefano Borini
Published on 2012-02-16T10:54:27Z
Indexed on
2012/03/20
23:39 UTC
Read the original article
Hit count: 301
I have the following situation. Imagine you have a MainWindow object who is layouting two different widgets, ListWidget and DisplayWidget. ListWidget is populated with data from the disk. DisplayWidget shows the details of the selection the user performs in the ListWidget.
I am planning to do the following: in MainWindow I have the following objects:
- ListWidget
- ListView
- ListModel
- ListController
ListView is initialized passing the ListWidget. ListViewController is initialized passing the View and the Model.
Same happens for the DisplayWidget:
- DisplayWidget
- DisplayView
- DisplayModel
- DisplayController
I initialize the DisplayView with the widget, and initialize the Model with the ListController. I do this because the DisplayModel wraps the ListController to get the information about the current selection, and the data to be displayed in the DisplayView.
I am very rusty with MVC, being out of UI programming since a while. Is this the expected interaction layout for having different MVC triplets communicate ? In other words, MVC focus on the interaction of three objects. How do you put this interaction as a whole into a larger context of communication with other similar entities, MVC or not ?
© Programmers or respective owner