I started developing a simple iPhone card game, but I was completely stuck for a few days. This is my first program that I will do outside of the CS classes, so itβs not worth saying that it is 20 times bigger than anything I have ever done. I have a good idea about the basic principles of OO and simpler templates, but I'm struggling to create a good Model-View-Controller. I could work out some kind of procedural and closely related application, but I would like to use good OO methods. I want to avoid using the Singleton pattern.
I understand the big picture, but I am embarrassed when I try to wrap my head around its actual implementation.
So far, I (not using exact APIs like UIView):
GameModel class with instance variables Player Player, Player * dealer and Deck * gameDeck. Methods - (void) dealCardtoPlayer, - (Player *) getPlayer (so view / controller can use the link to easily get an estimate), etc. Player classes have information such as manual and rating. This is actually an implementation of the protocol, so I can use the status template if I need to.
Class GameController . Contains links to GameModel and GameView. That is all I can understand. If someone presses the click button in the GameView, this button method simply calls the hitPressed method in the controller, which then calls the GameModel method - (void) dealCardtoPlayer: (Card *) topcard? Does the controller monitor the constant polling of the model to determine if the player has lost, or does the model register the controller as an observer and update it?
GameView. GameModel GameController ( ). - getPlayerHand 60 /, , ββ , ? ? ( ), , ? , . , - , , , .
:
, , ? .
, - . - , MVC GameController? , menuButtonPressed, ( , , ). , , ( , )?
: Google, , .
: OO/MVC?
, , MVC. , , - ( )...