|
|
|
|
|
by skydhash
284 days ago
|
|
Controller is where your logic is. Your model is your state, and the view is presentation. Both are static. The controller is the dynamic aspect that update the view to match the state and update the state according to interaction or some other system events. Splitting the logic from the state and presentation make the code very testable. You can either have the state as input and you test your presentation, or have the presentation as input (interaction and lifecycle events) and test your state (or its reflection in the presentation). Also this decoupling makes everything more flexible. You can switch your presentation layer or alter the mechanism for state storage and retrieval (cache, sync) without touching your logic. |
|
That's actually precisely the anti-pattern. Massive View Controller is an example of this.
The Model is where your logic is. Everything that is in any way semantically relevant.
Views handled display and editing (yes, also editing!). Controllers ... well ... I guess you might have a need for them.