Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I agree with you that an Interaction Service can be suitable for common interaction behaviour such as MessageBoxes etc. </p> <p>In my opinion, it boils down to class responsibility. In other words, do you want the ViewModel or the View to be responsible for specifying what type of interaction should take place?</p> <p>Consider a basic Interaction Service interface:</p> <pre><code>public interface IInteractionService{ MessageBoxResult ShowMessageBox(string messageBoxText, string caption, MessageBoxButton button); } </code></pre> <p>It's fairly obvious from observing the interface what type of behaviour ShowMessageBox is going to produce. This gives the ViewModel some degree of control in terms of specifying what type of interaction behaviour it expects to occur. The problem with this approach is your ViewModel now has a dependency on IInteractionService as well as being explicit in it's interaction behaviour expectations. This could make your ViewModel less reusable.</p> <p>With Interaction Objects, you can place more of the responsibility of interaction behaviour on the View. In other words, you can change the behaviour and appearance of the interaction without directly affecting the ViewModel. For example, V1 of the interaction request could display a simple MessageBox. V2 of the interaction request could be a more complex dialog requiring more user interaction that a simple button click. This kind of interaction behaviour change can be managed without requiring modification of the ViewModel. This can be useful if you have a UI designer working on the project who wants the option to swap out or change the behaviour or appearance of a view tied to an interaction request.</p> <p>You could use both strategies if you wanted. In other words, an Interaction Service for common interaction behaviours and Interaction Objects for more complex behaviour.</p> <p>To summarize, Interaction Services can be easier to use but Interaction Objects can make your ViewModels more reusable, in my opinion.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload