Objective-C - MVC Model using both local and remote data stores
If I had a Game model which controlled when Targets were fired and
received when these Targets were hit from the Controller, how would be the
best and preferred way to handle the possibility for the Game model to
have both a local and remote option?
Such that, a Game model could run a whole game offline locally by
controlling all game logic itself, however if the remote property was set
to true then it would send the Targets hit value to the remote server
which in turn would process the logic and return the data to be
stored/fired.
I would like the Game model to be reusable as possible, and all games
(local and remote) to be stored within a Players game array property.
The possibilities I can think of are..
1) To create a LocalGame and RemoteGame class which subclass Game
2) To create a remote property which determines the logic called in the
Game model, such that if remote == true then call server, otherwise run
local code
3) Create class addition files which are loaded by the controller (i.e.
Game+Remote.h) which separates the local/remote code as opposed to 2)
No comments:
Post a Comment