▲ | b_e_n_t_o_n 4 days ago | |
I feel like MVC is trying to get at a core concept of having your application state in one place, your view objects/state in another place, and then having a third piece that updates the application state. So like in React, you'd have your Redux store as the Model, React components (with useState etc) as the View, and then your Controller is the reducer which is called from UI code and updates the Model. Maybe that's incorrect definitionally, but it makes sense to me. | ||
▲ | js8 4 days ago | parent [-] | |
That's what I call "single vortex principle". The graph of data dependencies (flow of updates) in your application should ideally have only one circle (which includes the user). The minimal circles of data dependencies are what I call "vortices". Every time you have two different vortices in your application, a potential ambiguity arises about sequencing the updates. These are difficult to deal with and can cause bugs. As you say, in MVC, the vortex should be User -> Controller -> Model -> View -> User. Best if this is the only vortex (Flux pattern). This can be nicely expressed functionally. That's why I think beans (and mutable variables in general) are bad because each has it's own small vortex of updates. |