'Where is the game logic supposed to be in the Model-View ViewModel pattern in android
I'm currently developing a poker game app for android using the Model-View ViewModel pattern and I'm not sure where the correct place for the game logic should be. The architecture looks currently something like this:
GameActivity --> GameViewModel --> Repository --> Database
| ^
| :
| :
|-> PokerGame
The GameViewModel calls PokerGame Methods for initialising the game and passing interactions by the player. The PokerGame is observed by the GameViewModel. The PokerGame has an internal Thread which runs until the game is over and frequently passes data to the GameViewModel, like the current distribution of jetons.
Im working with Room and LiveData, so the GameActivity always triggers when changes are made to the database.
What would be a better approach, should the Repository hold the PokerGame instead?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
