This is a discussion on MVC Pattern within the Software Patterns forums, part of the Testing category; I am trying to learn and apply the model-view-controller pattern. I am having a little trouble grasping it ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
MVC Pattern
I am trying to learn and apply the model-view-controller pattern. I am
having a little trouble grasping it so far. What I gather so far is that the model uses the Observer pattern to notify its views. The controller updates the model. What does the controller do to the view? Should the controller talk to the view? --Steve |
|
|||
|
Re: MVC Pattern
Steve Green escribió:
> I am trying to learn and apply the model-view-controller pattern. I am > having a little trouble grasping it so far. What I gather so far is that the > model uses the Observer pattern to notify its views. The controller updates > the model. What does the controller do to the view? Should the controller > talk to the view? MVC on Java Swing: http://www.javadesktop.org/tsc/artic...ure/index.html Hope it helps, -- To reply by e-mail, please remove the extra dot in the given address: m.collado -> mcollado |
|
|||
|
Re: MVC Pattern
There is a very good/clear explanation of MVC in the new book
Head First Design Patterns Chapter 12: Patterns of Patterns It shows how the following 3 patterns 1. Strategy 2. Composite 3. Observer are combined in MVC. It is an excellent book on design patterns and the application of OO principles. |
|
|||
|
Re: MVC Pattern
Steve Green wrote: > I am trying to learn and apply the model-view-controller pattern. I am > having a little trouble grasping it so far. What I gather so far is that the > model uses the Observer pattern to notify its views. The controller updates > the model. What does the controller do to the view? Should the controller > talk to the view? You've got the basic idea. The controller only talks to the view if/when the view/controller has additional state which is not known to or a part of the model, but *is* visibly indicated as part of the view; e.g. current font selection {normal, bold italic}. Or to complete an interaction with the host OS, or perhaps telling the view to close, etc. Regards, -cstb .. |
|
|||
|
Re: MVC Pattern
>There is a very good/clear explanation of MVC in the new book
> >Head First Design Patterns > >Chapter 12: Patterns of Patterns > >It shows how the following 3 patterns > >1. Strategy >2. Composite >3. Observer > >are combined in MVC. > >It is an excellent book on design patterns and the application of OO >principles. Well, I went ahead an picked up a copy of this book. Hopefully it will be of some use. |
|
|||
|
Re: MVC Pattern
The Controller is usually implemented as states. It gets data from
Model and uses View as the way to output data. Users use the data to make his decision and give some feedbacks through View inorder to control the Controller(for example, change states) and the process repeats util reaching state EXIT. I like to see the MVC as a special kind mediator pattern. Since the controller separates the Model and View apart. The controller also works as state. So, the MVC is a combination of Mediator and State patterns...!? Steve Green wrote: > I am trying to learn and apply the model-view-controller pattern. I am > having a little trouble grasping it so far. What I gather so far is that the > model uses the Observer pattern to notify its views. The controller updates > the model. What does the controller do to the view? Should the controller > talk to the view? > > --Steve |
|
|||
|
Re: MVC Pattern
Steve Green wrote:
> I am trying to learn and apply the model-view-controller pattern. I am > having a little trouble grasping it so far. What I gather so far is that the > model uses the Observer pattern to notify its views. The controller updates > the model. What does the controller do to the view? Should the controller > talk to the view? > > --Steve > > If you're interested in going to the source, take a look at: http://st-www.cs.uiuc.edu/users/smarch/st-docs/mvc.html and as always wikipedia is a good source: http://en.wikipedia.org/wiki/MVC Kim |