So, I really like the idea of separating business logic
with UI code
(MVC or MVVM). But let's say that in an application some event happens (in business logic) and it needs user input (dialog) to continue.
For example if you have a simulation about money or stocks of some sort, and in your model you do some calculations and suddenly the stock prices are quite high and you want to ask the user to sell them ("yes-no" dialog). What is a good way to go about this? (I'm not making such an application, it's just an example, so please answer abstractly).
pseudo code:
update() {
...
if(stock->price > Stock::ADVICE_BUY_PRICE) {
showDialog("..."); // !! AVOID UI LOGIC IN MODEL !!
}
...
}
This question has probably been asked already, but I haven't found a good answer yet. Just mark answer as duplicate if there already is a viable answer.