Hey guys. I've some problems with understanding MVC.
I mean I know that Model stores data, Controller changes that data according to user input, and when changes happen, Model dispatches event, so View could catch it and render representation. But how do I suppose to arrange all that stuff? Do I need some kind of container class, which contains all in one Model, View and Controller? And most important: how do I build hierarchy with this? I've read about HMVC, but there's no answers too.
For example, I'm trying to make a tic-tac-toe game, and I have Game, which contains two Players, and Board.
Game has it's Model, View and Controller
GameModel contains two Players and Board
GameView represents two Players and Board
GameController responsible for taking turn.
Player has it's Model, View and Controller
PlayerModel contains state (active/inactive)
PlayerView represents Player screen
PlayerController implements logic (human/computer)
Board has it's Model, View and Controller
BoardModel contains cells
BoardView represent cells
BoardController mark cells (X/O)
MVC should help to organize code, but for now it turned my code into complete mess.
I've got my project here https://github.com/FennecFix/tictactoe
It would be so nice, if you help me organize my code correctly