Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"MVC" used in introduction #97

Open
Gamadril opened this issue Mar 15, 2016 · 4 comments
Open

"MVC" used in introduction #97

Gamadril opened this issue Mar 15, 2016 · 4 comments

Comments

@Gamadril
Copy link

Started with redux by looking at your tutorial. Thanks for sharing.
I have a question regarding the introduction:

// To get more clarity how MVC and flux differ, we'll
// take a classic use-case in an MVC application:
// In a classic MVC application you could easily end up with:
// 1) User clicks on button "A"
// 2) A click handler on button "A" triggers a change on Model "A"
// 3) A change handler on Model "A" triggers a change on Model "B"
// 4) A change handler on Model "B" triggers a change on View "B" that re-renders itself

Where is the "C" in "classic MVC" in that chain?

@starandtina
Copy link

@Gamadril

In a nutshell, the classic MVC architecture works like this. There is a model that is at the heart of the whole thing. If the model changes, it notifies its observers that a change occurred. The view is the stuff you can see and the view observes the model. When the view is notified that the model has changed, the view changes its appearance. The user can interact with the view (e.g. clicking stuff) but the view doesn’t know what to do. So the view tells the controller(This is the C) what the user did and assumes the controller knows what to do. The controller appropriately changes the model. And around and around it goes.

@Gamadril
Copy link
Author

thanks for clarification, but in the text above are only model and views, where is the controller?
Is it might be "the click handler" in 2) A click handler on button "A" triggers a change on Model "A"

@starandtina
Copy link

@Gamadril Yes, I think you're right. Correct me if I'm wrong.

@oliverbenns
Copy link

I agree with @Gamadril .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants