redux-tutorial icon indicating copy to clipboard operation
redux-tutorial copied to clipboard

"MVC" used in introduction

Open Gamadril opened this issue 8 years ago • 4 comments

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?

Gamadril avatar Mar 15 '16 08:03 Gamadril

@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.

starandtina avatar Mar 15 '16 13:03 starandtina

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"

Gamadril avatar Mar 15 '16 14:03 Gamadril

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

starandtina avatar Mar 16 '16 01:03 starandtina

I agree with @Gamadril .

oliverbenns avatar Mar 18 '16 03:03 oliverbenns