4 added 352 characters in body
source | link

Both ways will work, so they are both correct. And none of them is "better" in general, the first one is simpler, but the second one allows some things the first one does not, so you have to analyse your requirements if that additional complexity pays off.

MVP is a design allowing you to test the presenter and mocking out the view easily. It will also allow you to exchange one kind of view by another (for example, a view based on some desktop UI technology by a view based on some web or mobile UI technology). So the question you have to ask yourself here is

  • do you want or need to write unit tests for the "set label" logic, where the tests depend only on the presenter, not on the view?

  • do you want or need to reuse the "set label" logic in two different kind of views?

If the answer to one of this questions is "yes", use your second approach, if you can answer both with "no", the first approach is sufficient.

Note that your artificial, invented example hardly provides enough context to make a decision, you will probably need a real use case to validate your requirements. However, if you are just interested in how the term passive view is defined: Fowler's definition seems to fit better to your second approach, since updating anything in the view (like a label text) should not be done directly by the view itself, but by a controller or presenter.

Both ways will work, so they are both correct. And none of them is "better" in general, the first one is simpler, but the second one allows some things the first one does not, so you have to analyse your requirements if that additional complexity pays off.

MVP is a design allowing you to test the presenter and mocking out the view easily. It will also allow you to exchange one kind of view by another (for example, a view based on some desktop UI technology by a view based on some web or mobile UI technology). So the question you have to ask yourself here is

  • do you want or need to write unit tests for the "set label" logic, where the tests depend only on the presenter, not on the view?

  • do you want or need to reuse the "set label" logic in two different kind of views?

If the answer to one of this questions is "yes", use your second approach, if you can answer both with "no", the first approach is sufficient.

Note that your artificial, invented example hardly provides enough context to make a decision, you will probably need a real use case to validate your requirements.

Both ways will work, so they are both correct. And none of them is "better" in general, the first one is simpler, but the second one allows some things the first one does not, so you have to analyse your requirements if that additional complexity pays off.

MVP is a design allowing you to test the presenter and mocking out the view easily. It will also allow you to exchange one kind of view by another (for example, a view based on some desktop UI technology by a view based on some web or mobile UI technology). So the question you have to ask yourself here is

  • do you want or need to write unit tests for the "set label" logic, where the tests depend only on the presenter, not on the view?

  • do you want or need to reuse the "set label" logic in two different kind of views?

If the answer to one of this questions is "yes", use your second approach, if you can answer both with "no", the first approach is sufficient.

Note that your artificial, invented example hardly provides enough context to make a decision, you will probably need a real use case to validate your requirements. However, if you are just interested in how the term passive view is defined: Fowler's definition seems to fit better to your second approach, since updating anything in the view (like a label text) should not be done directly by the view itself, but by a controller or presenter.

3 added 42 characters in body
source | link

Both ways will work, so they are both correct. And none of them is "better" in general, the first one is simpler, but the second one allows some things the first one does not, so you have to analyse your requirements if that additional complexity pays off.  

MVP is a design allowing you to test the presenter and mocking out the view easily. It will also allow you to exchange one kind of view by another (for example, a view based on some desktop UI technology by a view based on some web or mobile UI technology). So the question you have to ask yourself here is

  • do you want or need to write unit tests for the "set label" logic, where the tests depend only on the presenter, not on the view?

  • do you want or need to reuse the "set label" logic in two different kind of views?

If the answer to one of this questions is "yes", use your second approach, if you can answer both with "no", the first approach is sufficient.

Note that your artificial, invented example hardly provides enough context to make a decision, you will probably need a real use case to validate your requirements.

Both ways will work, so they are both correct. And none of them is "better" in general, the first one is simpler, but the second allows some things the first one does not, so you have to analyse your requirements.  

MVP is a design allowing you to test the presenter and mocking out the view easily. It will also allow you to exchange one kind of view by another. So the question you have to ask yourself here is

  • do you want or need to write unit tests for the "set label" logic, where the tests depend only on the presenter, not on the view?

  • do you want or need to reuse the "set label" logic in two different kind of views?

If the answer to one of this questions is "yes", use your second approach, if you can answer both with "no", the first approach is sufficient.

Note that your artificial, invented example hardly provides enough context to make a decision, you will probably need a real use case to validate your requirements.

Both ways will work, so they are both correct. And none of them is "better" in general, the first one is simpler, but the second one allows some things the first one does not, so you have to analyse your requirements if that additional complexity pays off.

MVP is a design allowing you to test the presenter and mocking out the view easily. It will also allow you to exchange one kind of view by another (for example, a view based on some desktop UI technology by a view based on some web or mobile UI technology). So the question you have to ask yourself here is

  • do you want or need to write unit tests for the "set label" logic, where the tests depend only on the presenter, not on the view?

  • do you want or need to reuse the "set label" logic in two different kind of views?

If the answer to one of this questions is "yes", use your second approach, if you can answer both with "no", the first approach is sufficient.

Note that your artificial, invented example hardly provides enough context to make a decision, you will probably need a real use case to validate your requirements.

2 added 58 characters in body
source | link

Both ways will work, so they are both correct. And none of them is "better" in general, as long as you don't give a definition on howthe first one is simpler, but the second allows some things the first one does not, so you measure "better"have to analyse your requirements.

MVP is a design allowing you to test the presenter and mocking out the view easily. It will also allow you to exchange one kind of view by another. So the question you have to ask yourself here is

  • do you want/need or need to write unit tests for the "set label" logic, where the tests depend only on the presenter, not on the view?

  • do you want/need or need to reuse the "set label" logic in two different kind of views? 

If the answer to one of this questions is "yes", use your second approach, if you can answer both with "no", the first approach is sufficient.

Note that your artificial, invented example hardly provides enough context to make a decision, you will probably need a real use case to validate your requirements.

Both ways will work, so they are both correct. And none of them is "better" in general, as long as you don't give a definition on how you measure "better".

MVP is a design allowing you to test the presenter and mocking out the view easily. It will also allow you to exchange one kind of view by another. So the question you have to ask yourself here is

  • do you want/need to write unit tests for the "set label" logic, where the tests depend only on the presenter, not on the view?

  • do you want/need to reuse the "set label" logic in two different views?

If the answer to one of this questions is "yes", use your second approach, if you can answer both with "no", the first approach is sufficient.

Both ways will work, so they are both correct. And none of them is "better" in general, the first one is simpler, but the second allows some things the first one does not, so you have to analyse your requirements.

MVP is a design allowing you to test the presenter and mocking out the view easily. It will also allow you to exchange one kind of view by another. So the question you have to ask yourself here is

  • do you want or need to write unit tests for the "set label" logic, where the tests depend only on the presenter, not on the view?

  • do you want or need to reuse the "set label" logic in two different kind of views? 

If the answer to one of this questions is "yes", use your second approach, if you can answer both with "no", the first approach is sufficient.

Note that your artificial, invented example hardly provides enough context to make a decision, you will probably need a real use case to validate your requirements.

1
source | link