mvp design pattern - question -


When I have a button that changes something in my scene (like some text appears when I Suppressing), do I write my entire code with my thoughts in the file or should I be involved in handling this button's event in the presenter? This is a problem for me, because I do not know if the presenter handles all the events from the scene or is this only, which model changes something?

In advance thanks

The presenter only governs the events that change the model. However, each programmer decides what the model should be kept, and which is completely related to the scene.

Imagine the work, where you need to create 2 buttons, the first button loads the data from the database and displays it, and the second button changes the color of the page at some random value. There are 2 ways to apply this:

  1. The model will have loaded data loaded data and color color . The presenter will manage both buttons in this way.
  2. It can be decided that the color presentation is part of the part, and there is nothing to do with the model like this - the model will not have any color, and all random color generation and buttons are also seen. Will appear in the scene.

So, if you want, you can add all that / the model needs to insert that text / decide - the presenter can manage and manage that button But if this text is independent of the main argument and is part of the presentation (some design elements) - it should not be kept in the model and should not be managed by the presenter.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -