Login
Theme: Light Dark

Where does complex UI operations go in a Model-View-Controller (MVC) pattern?

Tagged:

Home - Quora Link

Good question. What I would do is to split up the operation into the parts that go on the model, the parts that go in the view, and if you have stuff that doesn’t belong in either, a private method on the controller is kind of the default. You can extract it out into a helper method if it bothers you.

Just use message sending to move data between the parts.

If you find yourself reusing the functionality, don’t just copy-paste, extract it into a helper and call the same code from the two views / models.

So, in short, first split along architecture lines, then extract and abstract as needed.